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.
@@ -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();
@@ -884,6 +884,23 @@ function getVideoSelectionOptions(currentVideoRange, videoPreference) {
884
884
  };
885
885
  }
886
886
 
887
+ const omitCircularRefsReplacer = replacer => {
888
+ const known = new WeakSet();
889
+ return (_, value) => {
890
+ if (replacer) {
891
+ value = replacer(_, value);
892
+ }
893
+ if (typeof value === 'object' && value !== null) {
894
+ if (known.has(value)) {
895
+ return;
896
+ }
897
+ known.add(value);
898
+ }
899
+ return value;
900
+ };
901
+ };
902
+ const stringify = (object, replacer) => JSON.stringify(object, omitCircularRefsReplacer(replacer));
903
+
887
904
  function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPreference, videoPreference) {
888
905
  const codecSets = Object.keys(codecTiers);
889
906
  const channelsPreference = audioPreference == null ? void 0 : audioPreference.channels;
@@ -963,7 +980,7 @@ function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPrefer
963
980
  return selected;
964
981
  }
965
982
  if (!videoRanges.some(range => candidateTier.videoRanges[range] > 0)) {
966
- logStartCodecCandidateIgnored(candidate, `no variants with VIDEO-RANGE of ${JSON.stringify(videoRanges)} found`);
983
+ logStartCodecCandidateIgnored(candidate, `no variants with VIDEO-RANGE of ${stringify(videoRanges)} found`);
967
984
  return selected;
968
985
  }
969
986
  if (videoCodecPreference && candidate.indexOf(videoCodecPreference.substring(0, 4)) % 5 !== 0) {
@@ -1628,7 +1645,7 @@ class AbrController extends Logger {
1628
1645
  currentVideoRange = preferHDR ? videoRanges[videoRanges.length - 1] : videoRanges[0];
1629
1646
  currentFrameRate = minFramerate;
1630
1647
  currentBw = Math.max(currentBw, minBitrate);
1631
- this.log(`picked start tier ${JSON.stringify(startTier)}`);
1648
+ this.log(`picked start tier ${stringify(startTier)}`);
1632
1649
  } else {
1633
1650
  currentCodecSet = level == null ? void 0 : level.codecSet;
1634
1651
  currentVideoRange = level == null ? void 0 : level.videoRange;
@@ -1698,16 +1715,19 @@ class AbrController extends Logger {
1698
1715
  return -1;
1699
1716
  }
1700
1717
  set nextAutoLevel(nextLevel) {
1701
- const {
1702
- maxAutoLevel,
1703
- minAutoLevel
1704
- } = this.hls;
1705
- const value = Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
1718
+ const value = this.deriveNextAutoLevel(nextLevel);
1706
1719
  if (this._nextAutoLevel !== value) {
1707
1720
  this.nextAutoLevelKey = '';
1708
1721
  this._nextAutoLevel = value;
1709
1722
  }
1710
1723
  }
1724
+ deriveNextAutoLevel(nextLevel) {
1725
+ const {
1726
+ maxAutoLevel,
1727
+ minAutoLevel
1728
+ } = this.hls;
1729
+ return Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
1730
+ }
1711
1731
  }
1712
1732
 
1713
1733
  const BinarySearch = {
@@ -5474,7 +5494,7 @@ function mergeDateRanges(oldDateRanges, newDetails) {
5474
5494
  dateRange.tagOrder += mergeCount;
5475
5495
  }
5476
5496
  } else {
5477
- logger.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(deltaDateRanges[id].attr)}"`);
5497
+ logger.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${stringify(deltaDateRanges[id].attr)}"`);
5478
5498
  }
5479
5499
  });
5480
5500
  }
@@ -9409,8 +9429,8 @@ class BufferController extends Logger {
9409
9429
  return;
9410
9430
  }
9411
9431
  this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
9412
- required tracks: ${JSON.stringify(requiredTracks, (key, value) => key === 'initSegment' ? undefined : value)};
9413
- transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'initSegment' ? undefined : value)}}`);
9432
+ required tracks: ${stringify(requiredTracks, (key, value) => key === 'initSegment' ? undefined : value)};
9433
+ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSegment' ? undefined : value)}}`);
9414
9434
  if (!isCompatibleTrackChange(transferredTracks, requiredTracks)) {
9415
9435
  // destroy attaching media source
9416
9436
  data.mediaSource = null;
@@ -10222,7 +10242,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10222
10242
  pendingTrackCount,
10223
10243
  tracks
10224
10244
  } = this;
10225
- this.log(`checkPendingTracks (pending: ${pendingTrackCount} codec events expected: ${bufferCodecEventsTotal}) ${JSON.stringify(tracks)}`);
10245
+ this.log(`checkPendingTracks (pending: ${pendingTrackCount} codec events expected: ${bufferCodecEventsTotal}) ${stringify(tracks)}`);
10226
10246
  // Check if we've received all of the expected bufferCodec events. When none remain, create all the sourceBuffers at once.
10227
10247
  // This is important because the MSE spec allows implementations to throw QuotaExceededErrors if creating new sourceBuffers after
10228
10248
  // data has been appended to existing ones.
@@ -10289,7 +10309,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
10289
10309
  const codec = this.getTrackCodec(track, type);
10290
10310
  const mimeType = `${track.container};codecs=${codec}`;
10291
10311
  track.codec = codec;
10292
- this.log(`creating sourceBuffer(${mimeType})${this.currentOp(type) ? ' Queued' : ''} ${JSON.stringify(track)}`);
10312
+ this.log(`creating sourceBuffer(${mimeType})${this.currentOp(type) ? ' Queued' : ''} ${stringify(track)}`);
10293
10313
  try {
10294
10314
  const sb = mediaSource.addSourceBuffer(mimeType);
10295
10315
  const sbIndex = sourceBufferNameToIndex(type);
@@ -10960,7 +10980,7 @@ class ContentSteeringController extends Logger {
10960
10980
  errorAction.resolved = this.pathwayId !== errorPathway;
10961
10981
  }
10962
10982
  if (!errorAction.resolved) {
10963
- 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)}`);
10983
+ 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)}`);
10964
10984
  }
10965
10985
  }
10966
10986
  }
@@ -17520,7 +17540,7 @@ function mergeConfig(defaultConfig, userConfig, logger) {
17520
17540
  }
17521
17541
  });
17522
17542
  if (report.length) {
17523
- logger.warn(`hls.js config: "${report.join('", "')}" setting(s) are deprecated, use "${policyName}": ${JSON.stringify(userConfig[policyName])}`);
17543
+ logger.warn(`hls.js config: "${report.join('", "')}" setting(s) are deprecated, use "${policyName}": ${stringify(userConfig[policyName])}`);
17524
17544
  }
17525
17545
  });
17526
17546
  return _objectSpread2(_objectSpread2({}, defaultsCopy), userConfig);
@@ -17944,7 +17964,7 @@ class GapController extends TaskLoop {
17944
17964
  if (!stallReported && stalled !== null && media && hls) {
17945
17965
  // Report stalled error once
17946
17966
  this.stallReported = true;
17947
- const error = new Error(`Playback stalling at @${media.currentTime} due to low buffer (${JSON.stringify(bufferInfo)})`);
17967
+ const error = new Error(`Playback stalling at @${media.currentTime} due to low buffer (${stringify(bufferInfo)})`);
17948
17968
  this.warn(error.message);
17949
17969
  hls.trigger(Events.ERROR, {
17950
17970
  type: ErrorTypes.MEDIA_ERROR,
@@ -18225,7 +18245,7 @@ function createCueWithDataFields(Cue, startTime, endTime, data, type) {
18225
18245
  cue.type = type;
18226
18246
  }
18227
18247
  } catch (e) {
18228
- cue = new Cue(startTime, endTime, JSON.stringify(type ? _objectSpread2({
18248
+ cue = new Cue(startTime, endTime, stringify(type ? _objectSpread2({
18229
18249
  type
18230
18250
  }, data) : data));
18231
18251
  }
@@ -18971,7 +18991,7 @@ class LevelController extends BasePlaylistController {
18971
18991
  Promise.resolve().then(() => {
18972
18992
  if (this.hls) {
18973
18993
  if (data.levels.length) {
18974
- this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(data.levels[0].attrs)}`);
18994
+ this.warn(`One or more CODECS in variant not supported: ${stringify(data.levels[0].attrs)}`);
18975
18995
  }
18976
18996
  const error = new Error('no level with compatible codecs found in manifest');
18977
18997
  this.hls.trigger(Events.ERROR, {
@@ -19384,7 +19404,7 @@ function assignTrackIdsByGroup(tracks) {
19384
19404
  });
19385
19405
  }
19386
19406
 
19387
- const version = "1.6.0-beta.3.0.canary.10978";
19407
+ const version = "1.6.0-beta.3.0.canary.10980";
19388
19408
 
19389
19409
  // ensure the worker ends up in the bundle
19390
19410
  // If the worker should not be included this gets aliased to empty.js
@@ -19568,7 +19588,7 @@ class TransmuxerInterface {
19568
19588
  cmd: 'init',
19569
19589
  typeSupported: m2tsTypeSupported,
19570
19590
  id,
19571
- config: JSON.stringify(config)
19591
+ config: stringify(config)
19572
19592
  });
19573
19593
  } catch (err) {
19574
19594
  logger.warn(`Error setting up "${id}" Web Worker, fallback to inline`, err);
@@ -19595,7 +19615,7 @@ class TransmuxerInterface {
19595
19615
  resetNo: instanceNo,
19596
19616
  typeSupported: m2tsTypeSupported,
19597
19617
  id: this.id,
19598
- config: JSON.stringify(config)
19618
+ config: stringify(config)
19599
19619
  });
19600
19620
  }
19601
19621
  }