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.mjs CHANGED
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
512
512
  // Some browsers don't allow to use bind on console object anyway
513
513
  // fallback to default if needed
514
514
  try {
515
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.8-0.canary.10071"}`);
515
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.8-0.canary.10075"}`);
516
516
  } catch (e) {
517
517
  /* log fn threw an exception. All logger methods are no-ops. */
518
518
  return createLogger();
@@ -23748,80 +23748,78 @@ class EMEKeyError extends Error {
23748
23748
  }
23749
23749
 
23750
23750
  /**
23751
- * Common Media Object Type
23751
+ * Common Media Client Data Object Type
23752
23752
  *
23753
23753
  * @group CMCD
23754
- * @group CMSD
23755
23754
  *
23756
23755
  * @beta
23757
23756
  */
23758
- var CmObjectType;
23759
- (function (CmObjectType) {
23757
+ var CmcdObjectType;
23758
+ (function (CmcdObjectType) {
23760
23759
  /**
23761
23760
  * text file, such as a manifest or playlist
23762
23761
  */
23763
- CmObjectType["MANIFEST"] = "m";
23762
+ CmcdObjectType["MANIFEST"] = "m";
23764
23763
  /**
23765
23764
  * audio only
23766
23765
  */
23767
- CmObjectType["AUDIO"] = "a";
23766
+ CmcdObjectType["AUDIO"] = "a";
23768
23767
  /**
23769
23768
  * video only
23770
23769
  */
23771
- CmObjectType["VIDEO"] = "v";
23770
+ CmcdObjectType["VIDEO"] = "v";
23772
23771
  /**
23773
23772
  * muxed audio and video
23774
23773
  */
23775
- CmObjectType["MUXED"] = "av";
23774
+ CmcdObjectType["MUXED"] = "av";
23776
23775
  /**
23777
23776
  * init segment
23778
23777
  */
23779
- CmObjectType["INIT"] = "i";
23778
+ CmcdObjectType["INIT"] = "i";
23780
23779
  /**
23781
23780
  * caption or subtitle
23782
23781
  */
23783
- CmObjectType["CAPTION"] = "c";
23782
+ CmcdObjectType["CAPTION"] = "c";
23784
23783
  /**
23785
23784
  * ISOBMFF timed text track
23786
23785
  */
23787
- CmObjectType["TIMED_TEXT"] = "tt";
23786
+ CmcdObjectType["TIMED_TEXT"] = "tt";
23788
23787
  /**
23789
23788
  * cryptographic key, license or certificate.
23790
23789
  */
23791
- CmObjectType["KEY"] = "k";
23790
+ CmcdObjectType["KEY"] = "k";
23792
23791
  /**
23793
23792
  * other
23794
23793
  */
23795
- CmObjectType["OTHER"] = "o";
23796
- })(CmObjectType || (CmObjectType = {}));
23794
+ CmcdObjectType["OTHER"] = "o";
23795
+ })(CmcdObjectType || (CmcdObjectType = {}));
23797
23796
 
23798
23797
  /**
23799
- * Common Media Streaming Format
23798
+ * Common Media Client Data Streaming Format
23800
23799
  *
23801
23800
  * @group CMCD
23802
- * @group CMSD
23803
23801
  *
23804
23802
  * @beta
23805
23803
  */
23806
- var CmStreamingFormat;
23807
- (function (CmStreamingFormat) {
23804
+ var CmcdStreamingFormat;
23805
+ (function (CmcdStreamingFormat) {
23808
23806
  /**
23809
23807
  * MPEG DASH
23810
23808
  */
23811
- CmStreamingFormat["DASH"] = "d";
23809
+ CmcdStreamingFormat["DASH"] = "d";
23812
23810
  /**
23813
23811
  * HTTP Live Streaming (HLS)
23814
23812
  */
23815
- CmStreamingFormat["HLS"] = "h";
23813
+ CmcdStreamingFormat["HLS"] = "h";
23816
23814
  /**
23817
23815
  * Smooth Streaming
23818
23816
  */
23819
- CmStreamingFormat["SMOOTH"] = "s";
23817
+ CmcdStreamingFormat["SMOOTH"] = "s";
23820
23818
  /**
23821
23819
  * Other
23822
23820
  */
23823
- CmStreamingFormat["OTHER"] = "o";
23824
- })(CmStreamingFormat || (CmStreamingFormat = {}));
23821
+ CmcdStreamingFormat["OTHER"] = "o";
23822
+ })(CmcdStreamingFormat || (CmcdStreamingFormat = {}));
23825
23823
 
23826
23824
  /**
23827
23825
  * CMCD header fields.
@@ -23873,8 +23871,6 @@ const CmcdHeaderMap = {
23873
23871
  */
23874
23872
  class SfItem {
23875
23873
  constructor(value, params) {
23876
- this.value = void 0;
23877
- this.params = void 0;
23878
23874
  if (Array.isArray(value)) {
23879
23875
  value = value.map(v => v instanceof SfItem ? v : new SfItem(v));
23880
23876
  }
@@ -23919,7 +23915,6 @@ function serializeError(src, type, cause) {
23919
23915
  */
23920
23916
  class SfToken {
23921
23917
  constructor(description) {
23922
- this.description = void 0;
23923
23918
  this.description = description;
23924
23919
  }
23925
23920
  }
@@ -24149,6 +24144,15 @@ function serializeString(value) {
24149
24144
  return `"${value.replace(/\\/g, `\\\\`).replace(/"/g, `\\"`)}"`;
24150
24145
  }
24151
24146
 
24147
+ /**
24148
+ * Converts a symbol to a string.
24149
+ *
24150
+ * @param symbol - The symbol to convert.
24151
+ *
24152
+ * @returns The string representation of the symbol.
24153
+ *
24154
+ * @internal
24155
+ */
24152
24156
  function symbolToStr(symbol) {
24153
24157
  return symbol.description || symbol.toString().slice(7, -1);
24154
24158
  }
@@ -24379,7 +24383,7 @@ function serializeDict(dict, options = {
24379
24383
  throw serializeError(dict, DICT);
24380
24384
  }
24381
24385
  const entries = dict instanceof Map ? dict.entries() : Object.entries(dict);
24382
- const optionalWhiteSpace = options != null && options.whitespace ? ' ' : '';
24386
+ const optionalWhiteSpace = (options === null || options === void 0 ? void 0 : options.whitespace) ? ' ' : '';
24383
24387
  return Array.from(entries).map(([key, item]) => {
24384
24388
  if (item instanceof SfItem === false) {
24385
24389
  item = new SfItem(item);
@@ -24402,7 +24406,9 @@ function serializeDict(dict, options = {
24402
24406
  /**
24403
24407
  * Encode an object into a structured field dictionary
24404
24408
  *
24405
- * @param input - The structured field dictionary to encode
24409
+ * @param value - The structured field dictionary to encode
24410
+ * @param options - Encoding options
24411
+ *
24406
24412
  * @returns The structured field string
24407
24413
  *
24408
24414
  * @group Structured Field
@@ -24421,11 +24427,18 @@ function encodeSfDict(value, options) {
24421
24427
  * @returns `true` if the key is a token field.
24422
24428
  *
24423
24429
  * @internal
24424
- *
24425
- * @group CMCD
24426
24430
  */
24427
24431
  const isTokenField = key => key === 'ot' || key === 'sf' || key === 'st';
24428
24432
 
24433
+ /**
24434
+ * Checks if the given value is valid
24435
+ *
24436
+ * @param value - The value to check.
24437
+ *
24438
+ * @returns `true` if the key is a value is valid.
24439
+ *
24440
+ * @internal
24441
+ */
24429
24442
  const isValid = value => {
24430
24443
  if (typeof value === 'number') {
24431
24444
  return isFiniteNumber(value);
@@ -24467,7 +24480,7 @@ function urlToRelativePath(url, base) {
24467
24480
 
24468
24481
  const toRounded = value => Math.round(value);
24469
24482
  const toUrlSafe = (value, options) => {
24470
- if (options != null && options.baseUrl) {
24483
+ if (options === null || options === void 0 ? void 0 : options.baseUrl) {
24471
24484
  value = urlToRelativePath(value, options.baseUrl);
24472
24485
  }
24473
24486
  return encodeURIComponent(value);
@@ -24532,10 +24545,10 @@ function processCmcd(obj, options) {
24532
24545
  return results;
24533
24546
  }
24534
24547
  const keys = Object.keys(obj).sort();
24535
- const formatters = _extends({}, CmcdFormatters, options == null ? void 0 : options.formatters);
24536
- const filter = options == null ? void 0 : options.filter;
24548
+ const formatters = _extends({}, CmcdFormatters, options === null || options === void 0 ? void 0 : options.formatters);
24549
+ const filter = options === null || options === void 0 ? void 0 : options.filter;
24537
24550
  keys.forEach(key => {
24538
- if (filter != null && filter(key)) {
24551
+ if (filter === null || filter === void 0 ? void 0 : filter(key)) {
24539
24552
  return;
24540
24553
  }
24541
24554
  let value = obj[key];
@@ -24601,12 +24614,12 @@ function toCmcdHeaders(cmcd, options = {}) {
24601
24614
  return {};
24602
24615
  }
24603
24616
  const entries = Object.entries(cmcd);
24604
- const headerMap = Object.entries(CmcdHeaderMap).concat(Object.entries((options == null ? void 0 : options.customHeaderMap) || {}));
24617
+ const headerMap = Object.entries(CmcdHeaderMap).concat(Object.entries((options === null || options === void 0 ? void 0 : options.customHeaderMap) || {}));
24605
24618
  const shards = entries.reduce((acc, entry) => {
24606
- var _headerMap$find, _acc$field;
24619
+ var _a, _b;
24607
24620
  const [key, value] = entry;
24608
- const field = ((_headerMap$find = headerMap.find(entry => entry[1].includes(key))) == null ? void 0 : _headerMap$find[0]) || CmcdHeaderField.REQUEST;
24609
- (_acc$field = acc[field]) != null ? _acc$field : acc[field] = {};
24621
+ const field = ((_a = headerMap.find(entry => entry[1].includes(key))) === null || _a === void 0 ? void 0 : _a[0]) || CmcdHeaderField.REQUEST;
24622
+ (_b = acc[field]) !== null && _b !== void 0 ? _b : acc[field] = {};
24610
24623
  acc[field][key] = value;
24611
24624
  return acc;
24612
24625
  }, {});
@@ -24621,7 +24634,7 @@ function toCmcdHeaders(cmcd, options = {}) {
24621
24634
  *
24622
24635
  * @param headers - The headers to append to.
24623
24636
  * @param cmcd - The CMCD object to append.
24624
- * @param customHeaderMap - A map of custom CMCD keys to header fields.
24637
+ * @param options - Encode options.
24625
24638
  *
24626
24639
  * @returns The headers with the CMCD header shards appended.
24627
24640
  *
@@ -24759,7 +24772,7 @@ class CMCDController {
24759
24772
  this.applyPlaylistData = context => {
24760
24773
  try {
24761
24774
  this.apply(context, {
24762
- ot: CmObjectType.MANIFEST,
24775
+ ot: CmcdObjectType.MANIFEST,
24763
24776
  su: !this.initialized
24764
24777
  });
24765
24778
  } catch (error) {
@@ -24778,7 +24791,7 @@ class CMCDController {
24778
24791
  d: fragment.duration * 1000,
24779
24792
  ot
24780
24793
  };
24781
- if (ot === CmObjectType.VIDEO || ot === CmObjectType.AUDIO || ot == CmObjectType.MUXED) {
24794
+ if (ot === CmcdObjectType.VIDEO || ot === CmcdObjectType.AUDIO || ot == CmcdObjectType.MUXED) {
24782
24795
  data.br = level.bitrate / 1000;
24783
24796
  data.tb = this.getTopBandwidth(ot) / 1000;
24784
24797
  data.bl = this.getBufferLength(ot);
@@ -24857,7 +24870,7 @@ class CMCDController {
24857
24870
  var _this$media;
24858
24871
  return {
24859
24872
  v: 1,
24860
- sf: CmStreamingFormat.HLS,
24873
+ sf: CmcdStreamingFormat.HLS,
24861
24874
  sid: this.sid,
24862
24875
  cid: this.cid,
24863
24876
  pr: (_this$media = this.media) == null ? void 0 : _this$media.playbackRate,
@@ -24871,7 +24884,7 @@ class CMCDController {
24871
24884
  apply(context, data = {}) {
24872
24885
  // apply baseline data
24873
24886
  _extends(data, this.createData());
24874
- const isVideo = data.ot === CmObjectType.INIT || data.ot === CmObjectType.VIDEO || data.ot === CmObjectType.MUXED;
24887
+ const isVideo = data.ot === CmcdObjectType.INIT || data.ot === CmcdObjectType.VIDEO || data.ot === CmcdObjectType.MUXED;
24875
24888
  if (this.starved && isVideo) {
24876
24889
  data.bs = true;
24877
24890
  data.su = true;
@@ -24922,19 +24935,19 @@ class CMCDController {
24922
24935
  type
24923
24936
  } = fragment;
24924
24937
  if (type === 'subtitle') {
24925
- return CmObjectType.TIMED_TEXT;
24938
+ return CmcdObjectType.TIMED_TEXT;
24926
24939
  }
24927
24940
  if (fragment.sn === 'initSegment') {
24928
- return CmObjectType.INIT;
24941
+ return CmcdObjectType.INIT;
24929
24942
  }
24930
24943
  if (type === 'audio') {
24931
- return CmObjectType.AUDIO;
24944
+ return CmcdObjectType.AUDIO;
24932
24945
  }
24933
24946
  if (type === 'main') {
24934
24947
  if (!this.hls.audioTracks.length) {
24935
- return CmObjectType.MUXED;
24948
+ return CmcdObjectType.MUXED;
24936
24949
  }
24937
- return CmObjectType.VIDEO;
24950
+ return CmcdObjectType.VIDEO;
24938
24951
  }
24939
24952
  return undefined;
24940
24953
  }
@@ -24946,7 +24959,7 @@ class CMCDController {
24946
24959
  let bitrate = 0;
24947
24960
  let levels;
24948
24961
  const hls = this.hls;
24949
- if (type === CmObjectType.AUDIO) {
24962
+ if (type === CmcdObjectType.AUDIO) {
24950
24963
  levels = hls.audioTracks;
24951
24964
  } else {
24952
24965
  const max = hls.maxAutoLevel;
@@ -24966,7 +24979,7 @@ class CMCDController {
24966
24979
  */
24967
24980
  getBufferLength(type) {
24968
24981
  const media = this.media;
24969
- const buffer = type === CmObjectType.AUDIO ? this.audioBuffer : this.videoBuffer;
24982
+ const buffer = type === CmcdObjectType.AUDIO ? this.audioBuffer : this.videoBuffer;
24970
24983
  if (!buffer || !media) {
24971
24984
  return NaN;
24972
24985
  }
@@ -28719,7 +28732,7 @@ class Hls {
28719
28732
  * Get the video-dev/hls.js package version.
28720
28733
  */
28721
28734
  static get version() {
28722
- return "1.5.8-0.canary.10071";
28735
+ return "1.5.8-0.canary.10075";
28723
28736
  }
28724
28737
 
28725
28738
  /**