hls.js 1.6.0-beta.3.0.canary.10978 → 1.6.0-beta.3.0.canary.10980

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
@@ -402,7 +402,7 @@ function enableLogs(debugConfig, context, id) {
402
402
  // Some browsers don't allow to use bind on console object anyway
403
403
  // fallback to default if needed
404
404
  try {
405
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.3.0.canary.10978"}`);
405
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.3.0.canary.10980"}`);
406
406
  } catch (e) {
407
407
  /* log fn threw an exception. All logger methods are no-ops. */
408
408
  return createLogger();
@@ -1001,6 +1001,23 @@ function getVideoSelectionOptions(currentVideoRange, videoPreference) {
1001
1001
  };
1002
1002
  }
1003
1003
 
1004
+ const omitCircularRefsReplacer = replacer => {
1005
+ const known = new WeakSet();
1006
+ return (_, value) => {
1007
+ if (replacer) {
1008
+ value = replacer(_, value);
1009
+ }
1010
+ if (typeof value === 'object' && value !== null) {
1011
+ if (known.has(value)) {
1012
+ return;
1013
+ }
1014
+ known.add(value);
1015
+ }
1016
+ return value;
1017
+ };
1018
+ };
1019
+ const stringify = (object, replacer) => JSON.stringify(object, omitCircularRefsReplacer(replacer));
1020
+
1004
1021
  function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPreference, videoPreference) {
1005
1022
  const codecSets = Object.keys(codecTiers);
1006
1023
  const channelsPreference = audioPreference == null ? void 0 : audioPreference.channels;
@@ -1080,7 +1097,7 @@ function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPrefer
1080
1097
  return selected;
1081
1098
  }
1082
1099
  if (!videoRanges.some(range => candidateTier.videoRanges[range] > 0)) {
1083
- logStartCodecCandidateIgnored(candidate, `no variants with VIDEO-RANGE of ${JSON.stringify(videoRanges)} found`);
1100
+ logStartCodecCandidateIgnored(candidate, `no variants with VIDEO-RANGE of ${stringify(videoRanges)} found`);
1084
1101
  return selected;
1085
1102
  }
1086
1103
  if (videoCodecPreference && candidate.indexOf(videoCodecPreference.substring(0, 4)) % 5 !== 0) {
@@ -1873,7 +1890,7 @@ class AbrController extends Logger {
1873
1890
  currentVideoRange = preferHDR ? videoRanges[videoRanges.length - 1] : videoRanges[0];
1874
1891
  currentFrameRate = minFramerate;
1875
1892
  currentBw = Math.max(currentBw, minBitrate);
1876
- this.log(`picked start tier ${JSON.stringify(startTier)}`);
1893
+ this.log(`picked start tier ${stringify(startTier)}`);
1877
1894
  } else {
1878
1895
  currentCodecSet = level == null ? void 0 : level.codecSet;
1879
1896
  currentVideoRange = level == null ? void 0 : level.videoRange;
@@ -1902,9 +1919,9 @@ class AbrController extends Logger {
1902
1919
  const levels = this.hls.levels;
1903
1920
  const index = levels.indexOf(levelInfo);
1904
1921
  if (decodingInfo.error) {
1905
- this.warn(`MediaCapabilities decodingInfo error: "${decodingInfo.error}" for level ${index} ${JSON.stringify(decodingInfo)}`);
1922
+ this.warn(`MediaCapabilities decodingInfo error: "${decodingInfo.error}" for level ${index} ${stringify(decodingInfo)}`);
1906
1923
  } else if (!decodingInfo.supported) {
1907
- this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${index} ${JSON.stringify(decodingInfo)}`);
1924
+ this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${index} ${stringify(decodingInfo)}`);
1908
1925
  if (index > -1 && levels.length > 1) {
1909
1926
  this.log(`Removing unsupported level ${index}`);
1910
1927
  this.hls.removeLevel(index);
@@ -1973,16 +1990,19 @@ class AbrController extends Logger {
1973
1990
  return -1;
1974
1991
  }
1975
1992
  set nextAutoLevel(nextLevel) {
1976
- const {
1977
- maxAutoLevel,
1978
- minAutoLevel
1979
- } = this.hls;
1980
- const value = Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
1993
+ const value = this.deriveNextAutoLevel(nextLevel);
1981
1994
  if (this._nextAutoLevel !== value) {
1982
1995
  this.nextAutoLevelKey = '';
1983
1996
  this._nextAutoLevel = value;
1984
1997
  }
1985
1998
  }
1999
+ deriveNextAutoLevel(nextLevel) {
2000
+ const {
2001
+ maxAutoLevel,
2002
+ minAutoLevel
2003
+ } = this.hls;
2004
+ return Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
2005
+ }
1986
2006
  }
1987
2007
 
1988
2008
  const BinarySearch = {
@@ -7753,7 +7773,7 @@ function mergeDateRanges(oldDateRanges, newDetails) {
7753
7773
  dateRange.tagOrder += mergeCount;
7754
7774
  }
7755
7775
  } else {
7756
- logger.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(deltaDateRanges[id].attr)}"`);
7776
+ logger.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${stringify(deltaDateRanges[id].attr)}"`);
7757
7777
  }
7758
7778
  });
7759
7779
  }
@@ -9887,7 +9907,7 @@ var eventemitter3 = {exports: {}};
9887
9907
  var eventemitter3Exports = eventemitter3.exports;
9888
9908
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9889
9909
 
9890
- const version = "1.6.0-beta.3.0.canary.10978";
9910
+ const version = "1.6.0-beta.3.0.canary.10980";
9891
9911
 
9892
9912
  // ensure the worker ends up in the bundle
9893
9913
  // If the worker should not be included this gets aliased to empty.js
@@ -15936,7 +15956,7 @@ class TransmuxerInterface {
15936
15956
  cmd: 'init',
15937
15957
  typeSupported: m2tsTypeSupported,
15938
15958
  id,
15939
- config: JSON.stringify(config)
15959
+ config: stringify(config)
15940
15960
  });
15941
15961
  } catch (err) {
15942
15962
  logger.warn(`Error setting up "${id}" Web Worker, fallback to inline`, err);
@@ -15963,7 +15983,7 @@ class TransmuxerInterface {
15963
15983
  resetNo: instanceNo,
15964
15984
  typeSupported: m2tsTypeSupported,
15965
15985
  id: this.id,
15966
- config: JSON.stringify(config)
15986
+ config: stringify(config)
15967
15987
  });
15968
15988
  }
15969
15989
  }
@@ -18000,8 +18020,8 @@ class BufferController extends Logger {
18000
18020
  return;
18001
18021
  }
18002
18022
  this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
18003
- required tracks: ${JSON.stringify(requiredTracks, (key, value) => key === 'initSegment' ? undefined : value)};
18004
- transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'initSegment' ? undefined : value)}}`);
18023
+ required tracks: ${stringify(requiredTracks, (key, value) => key === 'initSegment' ? undefined : value)};
18024
+ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSegment' ? undefined : value)}}`);
18005
18025
  if (!isCompatibleTrackChange(transferredTracks, requiredTracks)) {
18006
18026
  // destroy attaching media source
18007
18027
  data.mediaSource = null;
@@ -18813,7 +18833,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
18813
18833
  pendingTrackCount,
18814
18834
  tracks
18815
18835
  } = this;
18816
- this.log(`checkPendingTracks (pending: ${pendingTrackCount} codec events expected: ${bufferCodecEventsTotal}) ${JSON.stringify(tracks)}`);
18836
+ this.log(`checkPendingTracks (pending: ${pendingTrackCount} codec events expected: ${bufferCodecEventsTotal}) ${stringify(tracks)}`);
18817
18837
  // Check if we've received all of the expected bufferCodec events. When none remain, create all the sourceBuffers at once.
18818
18838
  // This is important because the MSE spec allows implementations to throw QuotaExceededErrors if creating new sourceBuffers after
18819
18839
  // data has been appended to existing ones.
@@ -18880,7 +18900,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
18880
18900
  const codec = this.getTrackCodec(track, type);
18881
18901
  const mimeType = `${track.container};codecs=${codec}`;
18882
18902
  track.codec = codec;
18883
- this.log(`creating sourceBuffer(${mimeType})${this.currentOp(type) ? ' Queued' : ''} ${JSON.stringify(track)}`);
18903
+ this.log(`creating sourceBuffer(${mimeType})${this.currentOp(type) ? ' Queued' : ''} ${stringify(track)}`);
18884
18904
  try {
18885
18905
  const sb = mediaSource.addSourceBuffer(mimeType);
18886
18906
  const sbIndex = sourceBufferNameToIndex(type);
@@ -20815,7 +20835,7 @@ class ContentSteeringController extends Logger {
20815
20835
  errorAction.resolved = this.pathwayId !== errorPathway;
20816
20836
  }
20817
20837
  if (!errorAction.resolved) {
20818
- this.warn(`Could not resolve ${data.details} ("${data.error.message}") with content-steering for Pathway: ${errorPathway} levels: ${levels ? levels.length : levels} priorities: ${JSON.stringify(pathwayPriority)} penalized: ${JSON.stringify(this.penalizedPathways)}`);
20838
+ this.warn(`Could not resolve ${data.details} ("${data.error.message}") with content-steering for Pathway: ${errorPathway} levels: ${levels ? levels.length : levels} priorities: ${stringify(pathwayPriority)} penalized: ${stringify(this.penalizedPathways)}`);
20819
20839
  }
20820
20840
  }
20821
20841
  }
@@ -21376,7 +21396,7 @@ class EMEController extends Logger {
21376
21396
  const keySystemAccessPromises = this.keySystemAccessPromises[keySystem];
21377
21397
  let keySystemAccess = keySystemAccessPromises == null ? void 0 : keySystemAccessPromises.keySystemAccess;
21378
21398
  if (!keySystemAccess) {
21379
- this.log(`Requesting encrypted media "${keySystem}" key-system access with config: ${JSON.stringify(mediaKeySystemConfigs)}`);
21399
+ this.log(`Requesting encrypted media "${keySystem}" key-system access with config: ${stringify(mediaKeySystemConfigs)}`);
21380
21400
  keySystemAccess = this.requestMediaKeySystemAccess(keySystem, mediaKeySystemConfigs);
21381
21401
  const _keySystemAccessPromises = this.keySystemAccessPromises[keySystem] = {
21382
21402
  keySystemAccess
@@ -21545,7 +21565,7 @@ class EMEController extends Logger {
21545
21565
  type: ErrorTypes.KEY_SYSTEM_ERROR,
21546
21566
  details: ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,
21547
21567
  fatal: true
21548
- }, `Missing key-system license configuration options ${JSON.stringify({
21568
+ }, `Missing key-system license configuration options ${stringify({
21549
21569
  drmSystems: this.config.drmSystems
21550
21570
  })}`);
21551
21571
  }
@@ -23685,20 +23705,6 @@ function removeEventListener(el, type, listener) {
23685
23705
  el.removeEventListener(type, listener);
23686
23706
  }
23687
23707
 
23688
- const replacer = () => {
23689
- const known = new WeakSet();
23690
- return (_, value) => {
23691
- if (typeof value === 'object' && value !== null) {
23692
- if (known.has(value)) {
23693
- return;
23694
- }
23695
- known.add(value);
23696
- }
23697
- return value;
23698
- };
23699
- };
23700
- const stringify = object => JSON.stringify(object, replacer());
23701
-
23702
23708
  function playWithCatch(media) {
23703
23709
  media == null ? void 0 : media.play().catch(() => {
23704
23710
  /* no-op */
@@ -26445,7 +26451,7 @@ class CaptionScreen {
26445
26451
  row.setCursor(absPos);
26446
26452
  }
26447
26453
  setPAC(pacData) {
26448
- this.logger.log(2, () => 'pacData = ' + JSON.stringify(pacData));
26454
+ this.logger.log(2, () => 'pacData = ' + stringify(pacData));
26449
26455
  let newRow = pacData.row - 1;
26450
26456
  if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {
26451
26457
  newRow = this.nrRollUpRows - 1;
@@ -26496,7 +26502,7 @@ class CaptionScreen {
26496
26502
  * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).
26497
26503
  */
26498
26504
  setBkgData(bkgData) {
26499
- this.logger.log(2, () => 'bkgData = ' + JSON.stringify(bkgData));
26505
+ this.logger.log(2, () => 'bkgData = ' + stringify(bkgData));
26500
26506
  this.backSpace();
26501
26507
  this.setPen(bkgData);
26502
26508
  this.insertChar(0x20); // Space
@@ -26736,7 +26742,7 @@ class Cea608Channel {
26736
26742
  } else {
26737
26743
  styles.foreground = 'white';
26738
26744
  }
26739
- this.logger.log(2, 'MIDROW: ' + JSON.stringify(styles));
26745
+ this.logger.log(2, 'MIDROW: ' + stringify(styles));
26740
26746
  this.writeScreen.setPen(styles);
26741
26747
  }
26742
26748
  outputDataUpdate(dispatch = false) {
@@ -29736,7 +29742,7 @@ function mergeConfig(defaultConfig, userConfig, logger) {
29736
29742
  }
29737
29743
  });
29738
29744
  if (report.length) {
29739
- logger.warn(`hls.js config: "${report.join('", "')}" setting(s) are deprecated, use "${policyName}": ${JSON.stringify(userConfig[policyName])}`);
29745
+ logger.warn(`hls.js config: "${report.join('", "')}" setting(s) are deprecated, use "${policyName}": ${stringify(userConfig[policyName])}`);
29740
29746
  }
29741
29747
  });
29742
29748
  return _objectSpread2(_objectSpread2({}, defaultsCopy), userConfig);
@@ -30152,7 +30158,7 @@ class GapController extends TaskLoop {
30152
30158
  if (!stallReported && stalled !== null && media && hls) {
30153
30159
  // Report stalled error once
30154
30160
  this.stallReported = true;
30155
- const error = new Error(`Playback stalling at @${media.currentTime} due to low buffer (${JSON.stringify(bufferInfo)})`);
30161
+ const error = new Error(`Playback stalling at @${media.currentTime} due to low buffer (${stringify(bufferInfo)})`);
30156
30162
  this.warn(error.message);
30157
30163
  hls.trigger(Events.ERROR, {
30158
30164
  type: ErrorTypes.MEDIA_ERROR,
@@ -30338,7 +30344,7 @@ function createCueWithDataFields(Cue, startTime, endTime, data, type) {
30338
30344
  cue.type = type;
30339
30345
  }
30340
30346
  } catch (e) {
30341
- cue = new Cue(startTime, endTime, JSON.stringify(type ? _objectSpread2({
30347
+ cue = new Cue(startTime, endTime, stringify(type ? _objectSpread2({
30342
30348
  type
30343
30349
  }, data) : data));
30344
30350
  }
@@ -31089,7 +31095,7 @@ class LevelController extends BasePlaylistController {
31089
31095
  Promise.resolve().then(() => {
31090
31096
  if (this.hls) {
31091
31097
  if (data.levels.length) {
31092
- this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(data.levels[0].attrs)}`);
31098
+ this.warn(`One or more CODECS in variant not supported: ${stringify(data.levels[0].attrs)}`);
31093
31099
  }
31094
31100
  const error = new Error('no level with compatible codecs found in manifest');
31095
31101
  this.hls.trigger(Events.ERROR, {