-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
dash.protection.debug.js
8995 lines (7661 loc) · 351 KB
/
dash.protection.debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["dashjs"] = factory();
else
root["dashjs"] = factory();
})(self, () => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/core/FactoryMaker.js":
/*!**********************************!*\
!*** ./src/core/FactoryMaker.js ***!
\**********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/**
* The copyright in this software is being made available under the BSD License,
* included below. This software may be subject to other third party and contributor
* rights, including patent rights, and no such rights are granted under this license.
*
* Copyright (c) 2013, Dash Industry Forum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* * Neither the name of Dash Industry Forum nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @module FactoryMaker
* @ignore
*/
var FactoryMaker = function () {
var instance;
var singletonContexts = [];
var singletonFactories = {};
var classFactories = {};
function extend(name, childInstance, override, context) {
if (!context[name] && childInstance) {
context[name] = {
instance: childInstance,
override: override
};
}
}
/**
* Use this method from your extended object. this.factory is injected into your object.
* this.factory.getSingletonInstance(this.context, 'VideoModel')
* will return the video model for use in the extended object.
*
* @param {Object} context - injected into extended object as this.context
* @param {string} className - string name found in all dash.js objects
* with name __dashjs_factory_name Will be at the bottom. Will be the same as the object's name.
* @returns {*} Context aware instance of specified singleton name.
* @memberof module:FactoryMaker
* @instance
*/
function getSingletonInstance(context, className) {
for (var i in singletonContexts) {
var obj = singletonContexts[i];
if (obj.context === context && obj.name === className) {
return obj.instance;
}
}
return null;
}
/**
* Use this method to add an singleton instance to the system. Useful for unit testing to mock objects etc.
*
* @param {Object} context
* @param {string} className
* @param {Object} instance
* @memberof module:FactoryMaker
* @instance
*/
function setSingletonInstance(context, className, instance) {
for (var i in singletonContexts) {
var obj = singletonContexts[i];
if (obj.context === context && obj.name === className) {
singletonContexts[i].instance = instance;
return;
}
}
singletonContexts.push({
name: className,
context: context,
instance: instance
});
}
/**
* Use this method to remove all singleton instances associated with a particular context.
*
* @param {Object} context
* @memberof module:FactoryMaker
* @instance
*/
function deleteSingletonInstances(context) {
singletonContexts = singletonContexts.filter(function (x) {
return x.context !== context;
});
}
/*------------------------------------------------------------------------------------------*/
// Factories storage Management
/*------------------------------------------------------------------------------------------*/
function getFactoryByName(name, factoriesArray) {
return factoriesArray[name];
}
function updateFactory(name, factory, factoriesArray) {
if (name in factoriesArray) {
factoriesArray[name] = factory;
}
}
/*------------------------------------------------------------------------------------------*/
// Class Factories Management
/*------------------------------------------------------------------------------------------*/
function updateClassFactory(name, factory) {
updateFactory(name, factory, classFactories);
}
function getClassFactoryByName(name) {
return getFactoryByName(name, classFactories);
}
function getClassFactory(classConstructor) {
var factory = getFactoryByName(classConstructor.__dashjs_factory_name, classFactories);
if (!factory) {
factory = function factory(context) {
if (context === undefined) {
context = {};
}
return {
create: function create() {
return merge(classConstructor, context, arguments);
}
};
};
classFactories[classConstructor.__dashjs_factory_name] = factory; // store factory
}
return factory;
}
/*------------------------------------------------------------------------------------------*/
// Singleton Factory MAangement
/*------------------------------------------------------------------------------------------*/
function updateSingletonFactory(name, factory) {
updateFactory(name, factory, singletonFactories);
}
function getSingletonFactoryByName(name) {
return getFactoryByName(name, singletonFactories);
}
function getSingletonFactory(classConstructor) {
var factory = getFactoryByName(classConstructor.__dashjs_factory_name, singletonFactories);
if (!factory) {
factory = function factory(context) {
var instance;
if (context === undefined) {
context = {};
}
return {
getInstance: function getInstance() {
// If we don't have an instance yet check for one on the context
if (!instance) {
instance = getSingletonInstance(context, classConstructor.__dashjs_factory_name);
} // If there's no instance on the context then create one
if (!instance) {
instance = merge(classConstructor, context, arguments);
singletonContexts.push({
name: classConstructor.__dashjs_factory_name,
context: context,
instance: instance
});
}
return instance;
}
};
};
singletonFactories[classConstructor.__dashjs_factory_name] = factory; // store factory
}
return factory;
}
function merge(classConstructor, context, args) {
var classInstance;
var className = classConstructor.__dashjs_factory_name;
var extensionObject = context[className];
if (extensionObject) {
var extension = extensionObject.instance;
if (extensionObject.override) {
//Override public methods in parent but keep parent.
classInstance = classConstructor.apply({
context: context
}, args);
extension = extension.apply({
context: context,
factory: instance,
parent: classInstance
}, args);
for (var prop in extension) {
if (classInstance.hasOwnProperty(prop)) {
classInstance[prop] = extension[prop];
}
}
} else {
//replace parent object completely with new object. Same as dijon.
return extension.apply({
context: context,
factory: instance
}, args);
}
} else {
// Create new instance of the class
classInstance = classConstructor.apply({
context: context
}, args);
} // Add getClassName function to class instance prototype (used by Debug)
classInstance.getClassName = function () {
return className;
};
return classInstance;
}
instance = {
extend: extend,
getSingletonInstance: getSingletonInstance,
setSingletonInstance: setSingletonInstance,
deleteSingletonInstances: deleteSingletonInstances,
getSingletonFactory: getSingletonFactory,
getSingletonFactoryByName: getSingletonFactoryByName,
updateSingletonFactory: updateSingletonFactory,
getClassFactory: getClassFactory,
getClassFactoryByName: getClassFactoryByName,
updateClassFactory: updateClassFactory
};
return instance;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FactoryMaker);
/***/ }),
/***/ "./src/core/Utils.js":
/*!***************************!*\
!*** ./src/core/Utils.js ***!
\***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path-browserify */ "./node_modules/path-browserify/index.js");
/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path_browserify__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var ua_parser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ua-parser-js */ "./node_modules/ua-parser-js/src/ua-parser.js");
/* harmony import */ var ua_parser_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(ua_parser_js__WEBPACK_IMPORTED_MODULE_1__);
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* The copyright in this software is being made available under the BSD License,
* included below. This software may be subject to other third party and contributor
* rights, including patent rights, and no such rights are granted under this license.
*
* Copyright (c) 2013, Dash Industry Forum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* * Neither the name of Dash Industry Forum nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @class
* @ignore
*/
var Utils = /*#__PURE__*/function () {
function Utils() {
_classCallCheck(this, Utils);
}
_createClass(Utils, null, [{
key: "mixin",
value: function mixin(dest, source, copy) {
var s;
var empty = {};
if (dest) {
for (var name in source) {
if (source.hasOwnProperty(name)) {
s = source[name];
if (!(name in dest) || dest[name] !== s && (!(name in empty) || empty[name] !== s)) {
if (_typeof(dest[name]) === 'object' && dest[name] !== null) {
dest[name] = Utils.mixin(dest[name], s, copy);
} else {
dest[name] = copy(s);
}
}
}
}
}
return dest;
}
}, {
key: "clone",
value: function clone(src) {
if (!src || _typeof(src) !== 'object') {
return src; // anything
}
var r;
if (src instanceof Array) {
// array
r = [];
for (var i = 0, l = src.length; i < l; ++i) {
if (i in src) {
r.push(Utils.clone(src[i]));
}
}
} else {
r = {};
}
return Utils.mixin(r, src, Utils.clone);
}
}, {
key: "addAditionalQueryParameterToUrl",
value: function addAditionalQueryParameterToUrl(url, params) {
try {
if (!params || params.length === 0) {
return url;
}
var modifiedUrl = new URL(url);
params.forEach(function (param) {
if (param.key && param.value) {
modifiedUrl.searchParams.set(param.key, param.value);
}
});
return modifiedUrl.href;
} catch (e) {
return url;
}
}
}, {
key: "parseHttpHeaders",
value: function parseHttpHeaders(headerStr) {
var headers = {};
if (!headerStr) {
return headers;
} // Trim headerStr to fix a MS Edge bug with xhr.getAllResponseHeaders method
// which send a string starting with a "\n" character
var headerPairs = headerStr.trim().split("\r\n");
for (var i = 0, ilen = headerPairs.length; i < ilen; i++) {
var headerPair = headerPairs[i];
var index = headerPair.indexOf(": ");
if (index > 0) {
headers[headerPair.substring(0, index)] = headerPair.substring(index + 2);
}
}
return headers;
}
}, {
key: "generateUuid",
value: function generateUuid() {
var dt = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);
});
return uuid;
}
}, {
key: "generateHashCode",
value: function generateHashCode(string) {
var hash = 0;
if (string.length === 0) {
return hash;
}
for (var i = 0; i < string.length; i++) {
var chr = string.charCodeAt(i);
hash = (hash << 5) - hash + chr;
hash |= 0;
}
return hash;
}
/**
* Compares both urls and returns a relative url (target relative to original)
* @param {string} originalUrl
* @param {string} targetUrl
* @return {string|*}
*/
}, {
key: "getRelativeUrl",
value: function getRelativeUrl(originalUrl, targetUrl) {
try {
var original = new URL(originalUrl);
var target = new URL(targetUrl); // Unify the protocol to compare the origins
original.protocol = target.protocol;
if (original.origin !== target.origin) {
return targetUrl;
} // Use the relative path implementation of the path library. We need to cut off the actual filename in the end to get the relative path
var relativePath = path_browserify__WEBPACK_IMPORTED_MODULE_0___default().relative(original.pathname.substr(0, original.pathname.lastIndexOf('/')), target.pathname.substr(0, target.pathname.lastIndexOf('/'))); // In case the relative path is empty (both path are equal) return the filename only. Otherwise add a slash in front of the filename
var startIndexOffset = relativePath.length === 0 ? 1 : 0;
relativePath += target.pathname.substr(target.pathname.lastIndexOf('/') + startIndexOffset, target.pathname.length - 1); // Build the other candidate, e.g. the 'host relative' path that starts with "/", and return the shortest of the two candidates.
if (target.pathname.length < relativePath.length) {
return target.pathname;
}
return relativePath;
} catch (e) {
return targetUrl;
}
}
}, {
key: "parseUserAgent",
value: function parseUserAgent() {
var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
try {
var uaString = ua === null ? typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase() : '' : '';
return (0,ua_parser_js__WEBPACK_IMPORTED_MODULE_1__.UAParser)(uaString);
} catch (e) {
return {};
}
}
/**
* Checks for existence of "http" or "https" in a string
* @param string
* @returns {boolean}
*/
}, {
key: "stringHasProtocol",
value: function stringHasProtocol(string) {
return /(http(s?)):\/\//i.test(string);
}
}]);
return Utils;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Utils);
/***/ }),
/***/ "./src/core/errors/ErrorsBase.js":
/*!***************************************!*\
!*** ./src/core/errors/ErrorsBase.js ***!
\***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* The copyright in this software is being made available under the BSD License,
* included below. This software may be subject to other third party and contributor
* rights, including patent rights, and no such rights are granted under this license.
*
* Copyright (c) 2013, Dash Industry Forum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* * Neither the name of Dash Industry Forum nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @class
* @ignore
*/
var ErrorsBase = /*#__PURE__*/function () {
function ErrorsBase() {
_classCallCheck(this, ErrorsBase);
}
_createClass(ErrorsBase, [{
key: "extend",
value: function extend(errors, config) {
if (!errors) return;
var override = config ? config.override : false;
var publicOnly = config ? config.publicOnly : false;
for (var err in errors) {
if (!errors.hasOwnProperty(err) || this[err] && !override) continue;
if (publicOnly && errors[err].indexOf('public_') === -1) continue;
this[err] = errors[err];
}
}
}]);
return ErrorsBase;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ErrorsBase);
/***/ }),
/***/ "./src/core/events/EventsBase.js":
/*!***************************************!*\
!*** ./src/core/events/EventsBase.js ***!
\***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* The copyright in this software is being made available under the BSD License,
* included below. This software may be subject to other third party and contributor
* rights, including patent rights, and no such rights are granted under this license.
*
* Copyright (c) 2013, Dash Industry Forum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* * Neither the name of Dash Industry Forum nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @class
* @ignore
*/
var EventsBase = /*#__PURE__*/function () {
function EventsBase() {
_classCallCheck(this, EventsBase);
}
_createClass(EventsBase, [{
key: "extend",
value: function extend(events, config) {
if (!events) return;
var override = config ? config.override : false;
var publicOnly = config ? config.publicOnly : false;
for (var evt in events) {
if (!events.hasOwnProperty(evt) || this[evt] && !override) continue;
if (publicOnly && events[evt].indexOf('public_') === -1) continue;
this[evt] = events[evt];
}
}
}]);
return EventsBase;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EventsBase);
/***/ }),
/***/ "./src/streaming/constants/Constants.js":
/*!**********************************************!*\
!*** ./src/streaming/constants/Constants.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* The copyright in this software is being made available under the BSD License,
* included below. This software may be subject to other third party and contributor
* rights, including patent rights, and no such rights are granted under this license.
*
* Copyright (c) 2013, Dash Industry Forum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* * Neither the name of Dash Industry Forum nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Constants declaration
* @class
* @ignore
* @hideconstructor
*/
var Constants = /*#__PURE__*/function () {
function Constants() {
_classCallCheck(this, Constants);
this.init();
}
_createClass(Constants, [{
key: "init",
value: function init() {
/**
* @constant {string} STREAM Stream media type. Mainly used to report metrics relative to the full stream
* @memberof Constants#
* @static
*/
this.STREAM = 'stream';
/**
* @constant {string} VIDEO Video media type
* @memberof Constants#
* @static
*/
this.VIDEO = 'video';
/**
* @constant {string} AUDIO Audio media type
* @memberof Constants#
* @static
*/
this.AUDIO = 'audio';
/**
* @constant {string} TEXT Text media type
* @memberof Constants#
* @static
*/
this.TEXT = 'text';
/**
* @constant {string} MUXED Muxed (video/audio in the same chunk) media type
* @memberof Constants#
* @static
*/
this.MUXED = 'muxed';
/**
* @constant {string} IMAGE Image media type
* @memberof Constants#
* @static
*/
this.IMAGE = 'image';
/**
* @constant {string} STPP STTP Subtitles format
* @memberof Constants#
* @static
*/
this.STPP = 'stpp';
/**
* @constant {string} TTML STTP Subtitles format
* @memberof Constants#
* @static
*/
this.TTML = 'ttml';
/**
* @constant {string} VTT STTP Subtitles format
* @memberof Constants#
* @static
*/
this.VTT = 'vtt';
/**
* @constant {string} WVTT STTP Subtitles format
* @memberof Constants#
* @static
*/
this.WVTT = 'wvtt';
/**
* @constant {string} Content Steering
* @memberof Constants#
* @static
*/
this.CONTENT_STEERING = 'contentSteering';
/**
* @constant {string} ABR_STRATEGY_DYNAMIC Dynamic Adaptive bitrate algorithm
* @memberof Constants#
* @static
*/
this.ABR_STRATEGY_DYNAMIC = 'abrDynamic';
/**
* @constant {string} ABR_STRATEGY_BOLA Adaptive bitrate algorithm based on Bola (buffer level)
* @memberof Constants#
* @static
*/
this.ABR_STRATEGY_BOLA = 'abrBola';
/**
* @constant {string} ABR_STRATEGY_L2A Adaptive bitrate algorithm based on L2A (online learning)
* @memberof Constants#
* @static
*/
this.ABR_STRATEGY_L2A = 'abrL2A';
/**
* @constant {string} ABR_STRATEGY_LoLP Adaptive bitrate algorithm based on LoL+
* @memberof Constants#
* @static
*/
this.ABR_STRATEGY_LoLP = 'abrLoLP';
/**
* @constant {string} ABR_STRATEGY_THROUGHPUT Adaptive bitrate algorithm based on throughput
* @memberof Constants#
* @static
*/
this.ABR_STRATEGY_THROUGHPUT = 'abrThroughput';
/**
* @constant {string} ABR_FETCH_THROUGHPUT_CALUCUALTION_DOWNLOADED_DATA Throughput calculation based on downloaded data array
* @memberof Constants#
* @static
*/
this.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA = 'abrFetchThroughputCalculationDownloadedData';
/**
* @constant {string} ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING Throughput calculation based on moof parsing
* @memberof Constants#
* @static
*/
this.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING = 'abrFetchThroughputCalculationMoofParsing';
/**
* @constant {string} ABR_FETCH_THROUGHPUT_CALCULATION_AAST Throughput calculation based on adjusted availability start time in low latency mode
* @memberof Constants#
* @static
*/
this.ABR_FETCH_THROUGHPUT_CALCULATION_AAST = 'abrFetchThroughputCalculationAAST';
/**
* @constant {string} LIVE_CATCHUP_MODE_DEFAULT Throughput calculation based on moof parsing
* @memberof Constants#
* @static
*/
this.LIVE_CATCHUP_MODE_DEFAULT = 'liveCatchupModeDefault';
/**
* @constant {string} LIVE_CATCHUP_MODE_LOLP Throughput calculation based on moof parsing
* @memberof Constants#
* @static
*/
this.LIVE_CATCHUP_MODE_LOLP = 'liveCatchupModeLoLP';
/**
* @constant {string} MOVING_AVERAGE_SLIDING_WINDOW Moving average sliding window
* @memberof Constants#
* @static
*/
this.MOVING_AVERAGE_SLIDING_WINDOW = 'slidingWindow';
/**
* @constant {string} EWMA Exponential moving average
* @memberof Constants#
* @static
*/
this.MOVING_AVERAGE_EWMA = 'ewma';
/**
* @constant {string} BAD_ARGUMENT_ERROR Invalid Arguments type of error
* @memberof Constants#
* @static
*/
this.BAD_ARGUMENT_ERROR = 'Invalid Arguments';
/**
* @constant {string} MISSING_CONFIG_ERROR Missing configuration parameters type of error
* @memberof Constants#
* @static
*/
this.MISSING_CONFIG_ERROR = 'Missing config parameter(s)';
/**
* @constant {string} TRACK_SWITCH_MODE_ALWAYS_REPLACE used to clear the buffered data (prior to current playback position) after track switch. Default for audio
* @memberof Constants#
* @static
*/
this.TRACK_SWITCH_MODE_ALWAYS_REPLACE = 'alwaysReplace';
/**
* @constant {string} TRACK_SWITCH_MODE_NEVER_REPLACE used to forbid clearing the buffered data (prior to current playback position) after track switch. Defers to fastSwitchEnabled for placement of new data. Default for video
* @memberof Constants#
* @static
*/
this.TRACK_SWITCH_MODE_NEVER_REPLACE = 'neverReplace';
/**
* @constant {string} TRACK_SELECTION_MODE_FIRST_TRACK makes the player select the first track found in the manifest.
* @memberof Constants#
* @static
*/
this.TRACK_SELECTION_MODE_FIRST_TRACK = 'firstTrack';
/**
* @constant {string} TRACK_SELECTION_MODE_HIGHEST_BITRATE makes the player select the track with a highest bitrate. This mode is a default mode.
* @memberof Constants#
* @static
*/
this.TRACK_SELECTION_MODE_HIGHEST_BITRATE = 'highestBitrate';
/**
* @constant {string} TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY makes the player select the track with the lowest bitrate per pixel average.
* @memberof Constants#
* @static
*/
this.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY = 'highestEfficiency';
/**
* @constant {string} TRACK_SELECTION_MODE_WIDEST_RANGE makes the player select the track with a widest range of bitrates.
* @memberof Constants#
* @static
*/
this.TRACK_SELECTION_MODE_WIDEST_RANGE = 'widestRange';
/**
* @constant {string} TRACK_SELECTION_MODE_WIDEST_RANGE makes the player select the track with the highest selectionPriority as defined in the manifest
* @memberof Constants#