hls.js 1.5.8-0.canary.10071 → 1.5.8-0.canary.10075

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hls.js CHANGED
@@ -644,7 +644,7 @@
644
644
  // Some browsers don't allow to use bind on console object anyway
645
645
  // fallback to default if needed
646
646
  try {
647
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.8-0.canary.10071");
647
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.8-0.canary.10075");
648
648
  } catch (e) {
649
649
  /* log fn threw an exception. All logger methods are no-ops. */
650
650
  return createLogger();
@@ -24360,80 +24360,78 @@
24360
24360
  }( /*#__PURE__*/_wrapNativeSuper(Error));
24361
24361
 
24362
24362
  /**
24363
- * Common Media Object Type
24363
+ * Common Media Client Data Object Type
24364
24364
  *
24365
24365
  * @group CMCD
24366
- * @group CMSD
24367
24366
  *
24368
24367
  * @beta
24369
24368
  */
24370
- var CmObjectType;
24371
- (function (CmObjectType) {
24369
+ var CmcdObjectType;
24370
+ (function (CmcdObjectType) {
24372
24371
  /**
24373
24372
  * text file, such as a manifest or playlist
24374
24373
  */
24375
- CmObjectType["MANIFEST"] = "m";
24374
+ CmcdObjectType["MANIFEST"] = "m";
24376
24375
  /**
24377
24376
  * audio only
24378
24377
  */
24379
- CmObjectType["AUDIO"] = "a";
24378
+ CmcdObjectType["AUDIO"] = "a";
24380
24379
  /**
24381
24380
  * video only
24382
24381
  */
24383
- CmObjectType["VIDEO"] = "v";
24382
+ CmcdObjectType["VIDEO"] = "v";
24384
24383
  /**
24385
24384
  * muxed audio and video
24386
24385
  */
24387
- CmObjectType["MUXED"] = "av";
24386
+ CmcdObjectType["MUXED"] = "av";
24388
24387
  /**
24389
24388
  * init segment
24390
24389
  */
24391
- CmObjectType["INIT"] = "i";
24390
+ CmcdObjectType["INIT"] = "i";
24392
24391
  /**
24393
24392
  * caption or subtitle
24394
24393
  */
24395
- CmObjectType["CAPTION"] = "c";
24394
+ CmcdObjectType["CAPTION"] = "c";
24396
24395
  /**
24397
24396
  * ISOBMFF timed text track
24398
24397
  */
24399
- CmObjectType["TIMED_TEXT"] = "tt";
24398
+ CmcdObjectType["TIMED_TEXT"] = "tt";
24400
24399
  /**
24401
24400
  * cryptographic key, license or certificate.
24402
24401
  */
24403
- CmObjectType["KEY"] = "k";
24402
+ CmcdObjectType["KEY"] = "k";
24404
24403
  /**
24405
24404
  * other
24406
24405
  */
24407
- CmObjectType["OTHER"] = "o";
24408
- })(CmObjectType || (CmObjectType = {}));
24406
+ CmcdObjectType["OTHER"] = "o";
24407
+ })(CmcdObjectType || (CmcdObjectType = {}));
24409
24408
 
24410
24409
  /**
24411
- * Common Media Streaming Format
24410
+ * Common Media Client Data Streaming Format
24412
24411
  *
24413
24412
  * @group CMCD
24414
- * @group CMSD
24415
24413
  *
24416
24414
  * @beta
24417
24415
  */
24418
- var CmStreamingFormat;
24419
- (function (CmStreamingFormat) {
24416
+ var CmcdStreamingFormat;
24417
+ (function (CmcdStreamingFormat) {
24420
24418
  /**
24421
24419
  * MPEG DASH
24422
24420
  */
24423
- CmStreamingFormat["DASH"] = "d";
24421
+ CmcdStreamingFormat["DASH"] = "d";
24424
24422
  /**
24425
24423
  * HTTP Live Streaming (HLS)
24426
24424
  */
24427
- CmStreamingFormat["HLS"] = "h";
24425
+ CmcdStreamingFormat["HLS"] = "h";
24428
24426
  /**
24429
24427
  * Smooth Streaming
24430
24428
  */
24431
- CmStreamingFormat["SMOOTH"] = "s";
24429
+ CmcdStreamingFormat["SMOOTH"] = "s";
24432
24430
  /**
24433
24431
  * Other
24434
24432
  */
24435
- CmStreamingFormat["OTHER"] = "o";
24436
- })(CmStreamingFormat || (CmStreamingFormat = {}));
24433
+ CmcdStreamingFormat["OTHER"] = "o";
24434
+ })(CmcdStreamingFormat || (CmcdStreamingFormat = {}));
24437
24435
 
24438
24436
  /**
24439
24437
  * CMCD header fields.
@@ -24480,8 +24478,6 @@
24480
24478
  * @beta
24481
24479
  */
24482
24480
  var SfItem = function SfItem(value, params) {
24483
- this.value = void 0;
24484
- this.params = void 0;
24485
24481
  if (Array.isArray(value)) {
24486
24482
  value = value.map(function (v) {
24487
24483
  return v instanceof SfItem ? v : new SfItem(v);
@@ -24526,7 +24522,6 @@
24526
24522
  * @beta
24527
24523
  */
24528
24524
  var SfToken = function SfToken(description) {
24529
- this.description = void 0;
24530
24525
  this.description = description;
24531
24526
  };
24532
24527
 
@@ -24755,6 +24750,15 @@
24755
24750
  return "\"" + value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"";
24756
24751
  }
24757
24752
 
24753
+ /**
24754
+ * Converts a symbol to a string.
24755
+ *
24756
+ * @param symbol - The symbol to convert.
24757
+ *
24758
+ * @returns The string representation of the symbol.
24759
+ *
24760
+ * @internal
24761
+ */
24758
24762
  function symbolToStr(symbol) {
24759
24763
  return symbol.description || symbol.toString().slice(7, -1);
24760
24764
  }
@@ -24981,7 +24985,6 @@
24981
24985
  //
24982
24986
  // 3. Return output.
24983
24987
  function serializeDict(dict, options) {
24984
- var _options;
24985
24988
  if (options === void 0) {
24986
24989
  options = {
24987
24990
  whitespace: true
@@ -24991,7 +24994,7 @@
24991
24994
  throw serializeError(dict, DICT);
24992
24995
  }
24993
24996
  var entries = dict instanceof Map ? dict.entries() : Object.entries(dict);
24994
- var optionalWhiteSpace = (_options = options) != null && _options.whitespace ? ' ' : '';
24997
+ var optionalWhiteSpace = (options === null || options === void 0 ? void 0 : options.whitespace) ? ' ' : '';
24995
24998
  return Array.from(entries).map(function (_ref) {
24996
24999
  var key = _ref[0],
24997
25000
  item = _ref[1];
@@ -25016,7 +25019,9 @@
25016
25019
  /**
25017
25020
  * Encode an object into a structured field dictionary
25018
25021
  *
25019
- * @param input - The structured field dictionary to encode
25022
+ * @param value - The structured field dictionary to encode
25023
+ * @param options - Encoding options
25024
+ *
25020
25025
  * @returns The structured field string
25021
25026
  *
25022
25027
  * @group Structured Field
@@ -25035,13 +25040,20 @@
25035
25040
  * @returns `true` if the key is a token field.
25036
25041
  *
25037
25042
  * @internal
25038
- *
25039
- * @group CMCD
25040
25043
  */
25041
25044
  var isTokenField = function isTokenField(key) {
25042
25045
  return key === 'ot' || key === 'sf' || key === 'st';
25043
25046
  };
25044
25047
 
25048
+ /**
25049
+ * Checks if the given value is valid
25050
+ *
25051
+ * @param value - The value to check.
25052
+ *
25053
+ * @returns `true` if the key is a value is valid.
25054
+ *
25055
+ * @internal
25056
+ */
25045
25057
  var isValid = function isValid(value) {
25046
25058
  if (typeof value === 'number') {
25047
25059
  return isFiniteNumber(value);
@@ -25085,7 +25097,7 @@
25085
25097
  return Math.round(value);
25086
25098
  };
25087
25099
  var toUrlSafe = function toUrlSafe(value, options) {
25088
- if (options != null && options.baseUrl) {
25100
+ if (options === null || options === void 0 ? void 0 : options.baseUrl) {
25089
25101
  value = urlToRelativePath(value, options.baseUrl);
25090
25102
  }
25091
25103
  return encodeURIComponent(value);
@@ -25152,10 +25164,10 @@
25152
25164
  return results;
25153
25165
  }
25154
25166
  var keys = Object.keys(obj).sort();
25155
- var formatters = _extends({}, CmcdFormatters, options == null ? void 0 : options.formatters);
25156
- var filter = options == null ? void 0 : options.filter;
25167
+ var formatters = _extends({}, CmcdFormatters, options === null || options === void 0 ? void 0 : options.formatters);
25168
+ var filter = options === null || options === void 0 ? void 0 : options.filter;
25157
25169
  keys.forEach(function (key) {
25158
- if (filter != null && filter(key)) {
25170
+ if (filter === null || filter === void 0 ? void 0 : filter(key)) {
25159
25171
  return;
25160
25172
  }
25161
25173
  var value = obj[key];
@@ -25220,7 +25232,6 @@
25220
25232
  * @beta
25221
25233
  */
25222
25234
  function toCmcdHeaders(cmcd, options) {
25223
- var _options;
25224
25235
  if (options === void 0) {
25225
25236
  options = {};
25226
25237
  }
@@ -25228,15 +25239,15 @@
25228
25239
  return {};
25229
25240
  }
25230
25241
  var entries = Object.entries(cmcd);
25231
- var headerMap = Object.entries(CmcdHeaderMap).concat(Object.entries(((_options = options) == null ? void 0 : _options.customHeaderMap) || {}));
25242
+ var headerMap = Object.entries(CmcdHeaderMap).concat(Object.entries((options === null || options === void 0 ? void 0 : options.customHeaderMap) || {}));
25232
25243
  var shards = entries.reduce(function (acc, entry) {
25233
- var _headerMap$find, _acc$field;
25244
+ var _a, _b;
25234
25245
  var key = entry[0],
25235
25246
  value = entry[1];
25236
- var field = ((_headerMap$find = headerMap.find(function (entry) {
25247
+ var field = ((_a = headerMap.find(function (entry) {
25237
25248
  return entry[1].includes(key);
25238
- })) == null ? void 0 : _headerMap$find[0]) || CmcdHeaderField.REQUEST;
25239
- (_acc$field = acc[field]) != null ? _acc$field : acc[field] = {};
25249
+ })) === null || _a === void 0 ? void 0 : _a[0]) || CmcdHeaderField.REQUEST;
25250
+ (_b = acc[field]) !== null && _b !== void 0 ? _b : acc[field] = {};
25240
25251
  acc[field][key] = value;
25241
25252
  return acc;
25242
25253
  }, {});
@@ -25253,7 +25264,7 @@
25253
25264
  *
25254
25265
  * @param headers - The headers to append to.
25255
25266
  * @param cmcd - The CMCD object to append.
25256
- * @param customHeaderMap - A map of custom CMCD keys to header fields.
25267
+ * @param options - Encode options.
25257
25268
  *
25258
25269
  * @returns The headers with the CMCD header shards appended.
25259
25270
  *
@@ -25395,7 +25406,7 @@
25395
25406
  this.applyPlaylistData = function (context) {
25396
25407
  try {
25397
25408
  _this.apply(context, {
25398
- ot: CmObjectType.MANIFEST,
25409
+ ot: CmcdObjectType.MANIFEST,
25399
25410
  su: !_this.initialized
25400
25411
  });
25401
25412
  } catch (error) {
@@ -25414,7 +25425,7 @@
25414
25425
  d: fragment.duration * 1000,
25415
25426
  ot: ot
25416
25427
  };
25417
- if (ot === CmObjectType.VIDEO || ot === CmObjectType.AUDIO || ot == CmObjectType.MUXED) {
25428
+ if (ot === CmcdObjectType.VIDEO || ot === CmcdObjectType.AUDIO || ot == CmcdObjectType.MUXED) {
25418
25429
  data.br = level.bitrate / 1000;
25419
25430
  data.tb = _this.getTopBandwidth(ot) / 1000;
25420
25431
  data.bl = _this.getBufferLength(ot);
@@ -25492,7 +25503,7 @@
25492
25503
  var _this$media;
25493
25504
  return {
25494
25505
  v: 1,
25495
- sf: CmStreamingFormat.HLS,
25506
+ sf: CmcdStreamingFormat.HLS,
25496
25507
  sid: this.sid,
25497
25508
  cid: this.cid,
25498
25509
  pr: (_this$media = this.media) == null ? void 0 : _this$media.playbackRate,
@@ -25509,7 +25520,7 @@
25509
25520
  }
25510
25521
  // apply baseline data
25511
25522
  _extends(data, this.createData());
25512
- var isVideo = data.ot === CmObjectType.INIT || data.ot === CmObjectType.VIDEO || data.ot === CmObjectType.MUXED;
25523
+ var isVideo = data.ot === CmcdObjectType.INIT || data.ot === CmcdObjectType.VIDEO || data.ot === CmcdObjectType.MUXED;
25513
25524
  if (this.starved && isVideo) {
25514
25525
  data.bs = true;
25515
25526
  data.su = true;
@@ -25556,19 +25567,19 @@
25556
25567
  _proto.getObjectType = function getObjectType(fragment) {
25557
25568
  var type = fragment.type;
25558
25569
  if (type === 'subtitle') {
25559
- return CmObjectType.TIMED_TEXT;
25570
+ return CmcdObjectType.TIMED_TEXT;
25560
25571
  }
25561
25572
  if (fragment.sn === 'initSegment') {
25562
- return CmObjectType.INIT;
25573
+ return CmcdObjectType.INIT;
25563
25574
  }
25564
25575
  if (type === 'audio') {
25565
- return CmObjectType.AUDIO;
25576
+ return CmcdObjectType.AUDIO;
25566
25577
  }
25567
25578
  if (type === 'main') {
25568
25579
  if (!this.hls.audioTracks.length) {
25569
- return CmObjectType.MUXED;
25580
+ return CmcdObjectType.MUXED;
25570
25581
  }
25571
- return CmObjectType.VIDEO;
25582
+ return CmcdObjectType.VIDEO;
25572
25583
  }
25573
25584
  return undefined;
25574
25585
  }
@@ -25580,7 +25591,7 @@
25580
25591
  var bitrate = 0;
25581
25592
  var levels;
25582
25593
  var hls = this.hls;
25583
- if (type === CmObjectType.AUDIO) {
25594
+ if (type === CmcdObjectType.AUDIO) {
25584
25595
  levels = hls.audioTracks;
25585
25596
  } else {
25586
25597
  var max = hls.maxAutoLevel;
@@ -25601,7 +25612,7 @@
25601
25612
  */;
25602
25613
  _proto.getBufferLength = function getBufferLength(type) {
25603
25614
  var media = this.media;
25604
- var buffer = type === CmObjectType.AUDIO ? this.audioBuffer : this.videoBuffer;
25615
+ var buffer = type === CmcdObjectType.AUDIO ? this.audioBuffer : this.videoBuffer;
25605
25616
  if (!buffer || !media) {
25606
25617
  return NaN;
25607
25618
  }
@@ -30225,7 +30236,7 @@
30225
30236
  * Get the video-dev/hls.js package version.
30226
30237
  */
30227
30238
  function get() {
30228
- return "1.5.8-0.canary.10071";
30239
+ return "1.5.8-0.canary.10075";
30229
30240
  }
30230
30241
  }, {
30231
30242
  key: "Events",