hls.js 1.6.0-beta.3.0.canary.10979 → 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.10979"}`);
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);
@@ -7756,7 +7773,7 @@ function mergeDateRanges(oldDateRanges, newDetails) {
7756
7773
  dateRange.tagOrder += mergeCount;
7757
7774
  }
7758
7775
  } else {
7759
- 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)}"`);
7760
7777
  }
7761
7778
  });
7762
7779
  }
@@ -9890,7 +9907,7 @@ var eventemitter3 = {exports: {}};
9890
9907
  var eventemitter3Exports = eventemitter3.exports;
9891
9908
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9892
9909
 
9893
- const version = "1.6.0-beta.3.0.canary.10979";
9910
+ const version = "1.6.0-beta.3.0.canary.10980";
9894
9911
 
9895
9912
  // ensure the worker ends up in the bundle
9896
9913
  // If the worker should not be included this gets aliased to empty.js
@@ -15939,7 +15956,7 @@ class TransmuxerInterface {
15939
15956
  cmd: 'init',
15940
15957
  typeSupported: m2tsTypeSupported,
15941
15958
  id,
15942
- config: JSON.stringify(config)
15959
+ config: stringify(config)
15943
15960
  });
15944
15961
  } catch (err) {
15945
15962
  logger.warn(`Error setting up "${id}" Web Worker, fallback to inline`, err);
@@ -15966,7 +15983,7 @@ class TransmuxerInterface {
15966
15983
  resetNo: instanceNo,
15967
15984
  typeSupported: m2tsTypeSupported,
15968
15985
  id: this.id,
15969
- config: JSON.stringify(config)
15986
+ config: stringify(config)
15970
15987
  });
15971
15988
  }
15972
15989
  }
@@ -18003,8 +18020,8 @@ class BufferController extends Logger {
18003
18020
  return;
18004
18021
  }
18005
18022
  this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
18006
- required tracks: ${JSON.stringify(requiredTracks, (key, value) => key === 'initSegment' ? undefined : value)};
18007
- 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)}}`);
18008
18025
  if (!isCompatibleTrackChange(transferredTracks, requiredTracks)) {
18009
18026
  // destroy attaching media source
18010
18027
  data.mediaSource = null;
@@ -18816,7 +18833,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
18816
18833
  pendingTrackCount,
18817
18834
  tracks
18818
18835
  } = this;
18819
- this.log(`checkPendingTracks (pending: ${pendingTrackCount} codec events expected: ${bufferCodecEventsTotal}) ${JSON.stringify(tracks)}`);
18836
+ this.log(`checkPendingTracks (pending: ${pendingTrackCount} codec events expected: ${bufferCodecEventsTotal}) ${stringify(tracks)}`);
18820
18837
  // Check if we've received all of the expected bufferCodec events. When none remain, create all the sourceBuffers at once.
18821
18838
  // This is important because the MSE spec allows implementations to throw QuotaExceededErrors if creating new sourceBuffers after
18822
18839
  // data has been appended to existing ones.
@@ -18883,7 +18900,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
18883
18900
  const codec = this.getTrackCodec(track, type);
18884
18901
  const mimeType = `${track.container};codecs=${codec}`;
18885
18902
  track.codec = codec;
18886
- this.log(`creating sourceBuffer(${mimeType})${this.currentOp(type) ? ' Queued' : ''} ${JSON.stringify(track)}`);
18903
+ this.log(`creating sourceBuffer(${mimeType})${this.currentOp(type) ? ' Queued' : ''} ${stringify(track)}`);
18887
18904
  try {
18888
18905
  const sb = mediaSource.addSourceBuffer(mimeType);
18889
18906
  const sbIndex = sourceBufferNameToIndex(type);
@@ -20818,7 +20835,7 @@ class ContentSteeringController extends Logger {
20818
20835
  errorAction.resolved = this.pathwayId !== errorPathway;
20819
20836
  }
20820
20837
  if (!errorAction.resolved) {
20821
- 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)}`);
20822
20839
  }
20823
20840
  }
20824
20841
  }
@@ -21379,7 +21396,7 @@ class EMEController extends Logger {
21379
21396
  const keySystemAccessPromises = this.keySystemAccessPromises[keySystem];
21380
21397
  let keySystemAccess = keySystemAccessPromises == null ? void 0 : keySystemAccessPromises.keySystemAccess;
21381
21398
  if (!keySystemAccess) {
21382
- 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)}`);
21383
21400
  keySystemAccess = this.requestMediaKeySystemAccess(keySystem, mediaKeySystemConfigs);
21384
21401
  const _keySystemAccessPromises = this.keySystemAccessPromises[keySystem] = {
21385
21402
  keySystemAccess
@@ -21548,7 +21565,7 @@ class EMEController extends Logger {
21548
21565
  type: ErrorTypes.KEY_SYSTEM_ERROR,
21549
21566
  details: ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,
21550
21567
  fatal: true
21551
- }, `Missing key-system license configuration options ${JSON.stringify({
21568
+ }, `Missing key-system license configuration options ${stringify({
21552
21569
  drmSystems: this.config.drmSystems
21553
21570
  })}`);
21554
21571
  }
@@ -23688,20 +23705,6 @@ function removeEventListener(el, type, listener) {
23688
23705
  el.removeEventListener(type, listener);
23689
23706
  }
23690
23707
 
23691
- const replacer = () => {
23692
- const known = new WeakSet();
23693
- return (_, value) => {
23694
- if (typeof value === 'object' && value !== null) {
23695
- if (known.has(value)) {
23696
- return;
23697
- }
23698
- known.add(value);
23699
- }
23700
- return value;
23701
- };
23702
- };
23703
- const stringify = object => JSON.stringify(object, replacer());
23704
-
23705
23708
  function playWithCatch(media) {
23706
23709
  media == null ? void 0 : media.play().catch(() => {
23707
23710
  /* no-op */
@@ -26448,7 +26451,7 @@ class CaptionScreen {
26448
26451
  row.setCursor(absPos);
26449
26452
  }
26450
26453
  setPAC(pacData) {
26451
- this.logger.log(2, () => 'pacData = ' + JSON.stringify(pacData));
26454
+ this.logger.log(2, () => 'pacData = ' + stringify(pacData));
26452
26455
  let newRow = pacData.row - 1;
26453
26456
  if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {
26454
26457
  newRow = this.nrRollUpRows - 1;
@@ -26499,7 +26502,7 @@ class CaptionScreen {
26499
26502
  * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).
26500
26503
  */
26501
26504
  setBkgData(bkgData) {
26502
- this.logger.log(2, () => 'bkgData = ' + JSON.stringify(bkgData));
26505
+ this.logger.log(2, () => 'bkgData = ' + stringify(bkgData));
26503
26506
  this.backSpace();
26504
26507
  this.setPen(bkgData);
26505
26508
  this.insertChar(0x20); // Space
@@ -26739,7 +26742,7 @@ class Cea608Channel {
26739
26742
  } else {
26740
26743
  styles.foreground = 'white';
26741
26744
  }
26742
- this.logger.log(2, 'MIDROW: ' + JSON.stringify(styles));
26745
+ this.logger.log(2, 'MIDROW: ' + stringify(styles));
26743
26746
  this.writeScreen.setPen(styles);
26744
26747
  }
26745
26748
  outputDataUpdate(dispatch = false) {
@@ -29739,7 +29742,7 @@ function mergeConfig(defaultConfig, userConfig, logger) {
29739
29742
  }
29740
29743
  });
29741
29744
  if (report.length) {
29742
- 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])}`);
29743
29746
  }
29744
29747
  });
29745
29748
  return _objectSpread2(_objectSpread2({}, defaultsCopy), userConfig);
@@ -30155,7 +30158,7 @@ class GapController extends TaskLoop {
30155
30158
  if (!stallReported && stalled !== null && media && hls) {
30156
30159
  // Report stalled error once
30157
30160
  this.stallReported = true;
30158
- 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)})`);
30159
30162
  this.warn(error.message);
30160
30163
  hls.trigger(Events.ERROR, {
30161
30164
  type: ErrorTypes.MEDIA_ERROR,
@@ -30341,7 +30344,7 @@ function createCueWithDataFields(Cue, startTime, endTime, data, type) {
30341
30344
  cue.type = type;
30342
30345
  }
30343
30346
  } catch (e) {
30344
- cue = new Cue(startTime, endTime, JSON.stringify(type ? _objectSpread2({
30347
+ cue = new Cue(startTime, endTime, stringify(type ? _objectSpread2({
30345
30348
  type
30346
30349
  }, data) : data));
30347
30350
  }
@@ -31092,7 +31095,7 @@ class LevelController extends BasePlaylistController {
31092
31095
  Promise.resolve().then(() => {
31093
31096
  if (this.hls) {
31094
31097
  if (data.levels.length) {
31095
- 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)}`);
31096
31099
  }
31097
31100
  const error = new Error('no level with compatible codecs found in manifest');
31098
31101
  this.hls.trigger(Events.ERROR, {