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.d.mts CHANGED
@@ -48,6 +48,7 @@ export declare class AbrController extends Logger implements AbrComponentAPI {
48
48
  private getBwEstimate;
49
49
  private findBestLevel;
50
50
  set nextAutoLevel(nextLevel: number);
51
+ protected deriveNextAutoLevel(nextLevel: number): number;
51
52
  }
52
53
 
53
54
  export declare type ABRControllerConfig = {
package/dist/hls.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare class AbrController extends Logger implements AbrComponentAPI {
48
48
  private getBwEstimate;
49
49
  private findBestLevel;
50
50
  set nextAutoLevel(nextLevel: number);
51
+ protected deriveNextAutoLevel(nextLevel: number): number;
51
52
  }
52
53
 
53
54
  export declare type ABRControllerConfig = {
package/dist/hls.js CHANGED
@@ -1059,7 +1059,7 @@
1059
1059
  // Some browsers don't allow to use bind on console object anyway
1060
1060
  // fallback to default if needed
1061
1061
  try {
1062
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3.0.canary.10978");
1062
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3.0.canary.10980");
1063
1063
  } catch (e) {
1064
1064
  /* log fn threw an exception. All logger methods are no-ops. */
1065
1065
  return createLogger();
@@ -1728,6 +1728,25 @@
1728
1728
  };
1729
1729
  }
1730
1730
 
1731
+ var omitCircularRefsReplacer = function omitCircularRefsReplacer(replacer) {
1732
+ var known = new WeakSet();
1733
+ return function (_, value) {
1734
+ if (replacer) {
1735
+ value = replacer(_, value);
1736
+ }
1737
+ if (typeof value === 'object' && value !== null) {
1738
+ if (known.has(value)) {
1739
+ return;
1740
+ }
1741
+ known.add(value);
1742
+ }
1743
+ return value;
1744
+ };
1745
+ };
1746
+ var stringify = function stringify(object, replacer) {
1747
+ return JSON.stringify(object, omitCircularRefsReplacer(replacer));
1748
+ };
1749
+
1731
1750
  function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPreference, videoPreference) {
1732
1751
  var codecSets = Object.keys(codecTiers);
1733
1752
  var channelsPreference = audioPreference == null ? void 0 : audioPreference.channels;
@@ -1815,7 +1834,7 @@
1815
1834
  if (!videoRanges.some(function (range) {
1816
1835
  return candidateTier.videoRanges[range] > 0;
1817
1836
  })) {
1818
- logStartCodecCandidateIgnored(candidate, "no variants with VIDEO-RANGE of " + JSON.stringify(videoRanges) + " found");
1837
+ logStartCodecCandidateIgnored(candidate, "no variants with VIDEO-RANGE of " + stringify(videoRanges) + " found");
1819
1838
  return selected;
1820
1839
  }
1821
1840
  if (videoCodecPreference && candidate.indexOf(videoCodecPreference.substring(0, 4)) % 5 !== 0) {
@@ -2535,7 +2554,7 @@
2535
2554
  currentVideoRange = preferHDR ? videoRanges[videoRanges.length - 1] : videoRanges[0];
2536
2555
  currentFrameRate = minFramerate;
2537
2556
  currentBw = Math.max(currentBw, minBitrate);
2538
- this.log("picked start tier " + JSON.stringify(startTier));
2557
+ this.log("picked start tier " + stringify(startTier));
2539
2558
  } else {
2540
2559
  currentCodecSet = level == null ? void 0 : level.codecSet;
2541
2560
  currentVideoRange = level == null ? void 0 : level.videoRange;
@@ -2564,9 +2583,9 @@
2564
2583
  var levels = _this3.hls.levels;
2565
2584
  var index = levels.indexOf(levelInfo);
2566
2585
  if (decodingInfo.error) {
2567
- _this3.warn("MediaCapabilities decodingInfo error: \"" + decodingInfo.error + "\" for level " + index + " " + JSON.stringify(decodingInfo));
2586
+ _this3.warn("MediaCapabilities decodingInfo error: \"" + decodingInfo.error + "\" for level " + index + " " + stringify(decodingInfo));
2568
2587
  } else if (!decodingInfo.supported) {
2569
- _this3.warn("Unsupported MediaCapabilities decodingInfo result for level " + index + " " + JSON.stringify(decodingInfo));
2588
+ _this3.warn("Unsupported MediaCapabilities decodingInfo result for level " + index + " " + stringify(decodingInfo));
2570
2589
  if (index > -1 && levels.length > 1) {
2571
2590
  _this3.log("Removing unsupported level " + index);
2572
2591
  _this3.hls.removeLevel(index);
@@ -2642,12 +2661,18 @@
2642
2661
  // not enough time budget even with quality level 0 ... rebuffering might happen
2643
2662
  return -1;
2644
2663
  };
2664
+ _proto.deriveNextAutoLevel = function deriveNextAutoLevel(nextLevel) {
2665
+ var _this$hls2 = this.hls,
2666
+ maxAutoLevel = _this$hls2.maxAutoLevel,
2667
+ minAutoLevel = _this$hls2.minAutoLevel;
2668
+ return Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
2669
+ };
2645
2670
  return _createClass(AbrController, [{
2646
2671
  key: "firstAutoLevel",
2647
2672
  get: function get() {
2648
- var _this$hls2 = this.hls,
2649
- maxAutoLevel = _this$hls2.maxAutoLevel,
2650
- minAutoLevel = _this$hls2.minAutoLevel;
2673
+ var _this$hls3 = this.hls,
2674
+ maxAutoLevel = _this$hls3.maxAutoLevel,
2675
+ minAutoLevel = _this$hls3.minAutoLevel;
2651
2676
  var bwEstimate = this.getBwEstimate();
2652
2677
  var maxStartDelay = this.hls.config.maxStarvationDelay;
2653
2678
  var abrAutoLevel = this.findBestLevel(bwEstimate, minAutoLevel, maxAutoLevel, 0, maxStartDelay, 1, 1);
@@ -2698,10 +2723,7 @@
2698
2723
  return nextABRAutoLevel;
2699
2724
  },
2700
2725
  set: function set(nextLevel) {
2701
- var _this$hls3 = this.hls,
2702
- maxAutoLevel = _this$hls3.maxAutoLevel,
2703
- minAutoLevel = _this$hls3.minAutoLevel;
2704
- var value = Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
2726
+ var value = this.deriveNextAutoLevel(nextLevel);
2705
2727
  if (this._nextAutoLevel !== value) {
2706
2728
  this.nextAutoLevelKey = '';
2707
2729
  this._nextAutoLevel = value;
@@ -8497,7 +8519,7 @@
8497
8519
  dateRange.tagOrder += mergeCount;
8498
8520
  }
8499
8521
  } else {
8500
- logger.warn("Ignoring invalid Playlist Delta Update DATERANGE tag: \"" + JSON.stringify(deltaDateRanges[id].attr) + "\"");
8522
+ logger.warn("Ignoring invalid Playlist Delta Update DATERANGE tag: \"" + stringify(deltaDateRanges[id].attr) + "\"");
8501
8523
  }
8502
8524
  });
8503
8525
  }
@@ -16358,7 +16380,7 @@
16358
16380
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16359
16381
  }
16360
16382
 
16361
- var version = "1.6.0-beta.3.0.canary.10978";
16383
+ var version = "1.6.0-beta.3.0.canary.10980";
16362
16384
 
16363
16385
  // ensure the worker ends up in the bundle
16364
16386
  // If the worker should not be included this gets aliased to empty.js
@@ -16539,7 +16561,7 @@
16539
16561
  cmd: 'init',
16540
16562
  typeSupported: m2tsTypeSupported,
16541
16563
  id: id,
16542
- config: JSON.stringify(config)
16564
+ config: stringify(config)
16543
16565
  });
16544
16566
  } catch (err) {
16545
16567
  logger.warn("Error setting up \"" + id + "\" Web Worker, fallback to inline", err);
@@ -16567,7 +16589,7 @@
16567
16589
  resetNo: instanceNo,
16568
16590
  typeSupported: m2tsTypeSupported,
16569
16591
  id: this.id,
16570
- config: JSON.stringify(config)
16592
+ config: stringify(config)
16571
16593
  });
16572
16594
  }
16573
16595
  };
@@ -18578,9 +18600,9 @@
18578
18600
  this.log("attachTransferred: waiting for SourceBuffer track info");
18579
18601
  return;
18580
18602
  }
18581
- this.log("attachTransferred: (bufferCodecEventsTotal " + this.bufferCodecEventsTotal + ")\nrequired tracks: " + JSON.stringify(requiredTracks, function (key, value) {
18603
+ this.log("attachTransferred: (bufferCodecEventsTotal " + this.bufferCodecEventsTotal + ")\nrequired tracks: " + stringify(requiredTracks, function (key, value) {
18582
18604
  return key === 'initSegment' ? undefined : value;
18583
- }) + ";\ntransfer tracks: " + JSON.stringify(transferredTracks, function (key, value) {
18605
+ }) + ";\ntransfer tracks: " + stringify(transferredTracks, function (key, value) {
18584
18606
  return key === 'initSegment' ? undefined : value;
18585
18607
  }) + "}");
18586
18608
  if (!isCompatibleTrackChange(transferredTracks, requiredTracks)) {
@@ -19371,7 +19393,7 @@
19371
19393
  var bufferCodecEventsTotal = this.bufferCodecEventsTotal,
19372
19394
  pendingTrackCount = this.pendingTrackCount,
19373
19395
  tracks = this.tracks;
19374
- this.log("checkPendingTracks (pending: " + pendingTrackCount + " codec events expected: " + bufferCodecEventsTotal + ") " + JSON.stringify(tracks));
19396
+ this.log("checkPendingTracks (pending: " + pendingTrackCount + " codec events expected: " + bufferCodecEventsTotal + ") " + stringify(tracks));
19375
19397
  // Check if we've received all of the expected bufferCodec events. When none remain, create all the sourceBuffers at once.
19376
19398
  // This is important because the MSE spec allows implementations to throw QuotaExceededErrors if creating new sourceBuffers after
19377
19399
  // data has been appended to existing ones.
@@ -19440,7 +19462,7 @@
19440
19462
  var codec = this.getTrackCodec(track, type);
19441
19463
  var mimeType = track.container + ";codecs=" + codec;
19442
19464
  track.codec = codec;
19443
- this.log("creating sourceBuffer(" + mimeType + ")" + (this.currentOp(type) ? ' Queued' : '') + " " + JSON.stringify(track));
19465
+ this.log("creating sourceBuffer(" + mimeType + ")" + (this.currentOp(type) ? ' Queued' : '') + " " + stringify(track));
19444
19466
  try {
19445
19467
  var sb = mediaSource.addSourceBuffer(mimeType);
19446
19468
  var sbIndex = sourceBufferNameToIndex(type);
@@ -21473,7 +21495,7 @@
21473
21495
  errorAction.resolved = this.pathwayId !== errorPathway;
21474
21496
  }
21475
21497
  if (!errorAction.resolved) {
21476
- 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));
21498
+ 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));
21477
21499
  }
21478
21500
  }
21479
21501
  };
@@ -22072,7 +22094,7 @@
22072
22094
  var keySystemAccessPromises = this.keySystemAccessPromises[keySystem];
22073
22095
  var keySystemAccess = keySystemAccessPromises == null ? void 0 : keySystemAccessPromises.keySystemAccess;
22074
22096
  if (!keySystemAccess) {
22075
- this.log("Requesting encrypted media \"" + keySystem + "\" key-system access with config: " + JSON.stringify(mediaKeySystemConfigs));
22097
+ this.log("Requesting encrypted media \"" + keySystem + "\" key-system access with config: " + stringify(mediaKeySystemConfigs));
22076
22098
  keySystemAccess = this.requestMediaKeySystemAccess(keySystem, mediaKeySystemConfigs);
22077
22099
  var _keySystemAccessPromises = this.keySystemAccessPromises[keySystem] = {
22078
22100
  keySystemAccess: keySystemAccess
@@ -22245,7 +22267,7 @@
22245
22267
  type: ErrorTypes.KEY_SYSTEM_ERROR,
22246
22268
  details: ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,
22247
22269
  fatal: true
22248
- }, "Missing key-system license configuration options " + JSON.stringify({
22270
+ }, "Missing key-system license configuration options " + stringify({
22249
22271
  drmSystems: this.config.drmSystems
22250
22272
  }));
22251
22273
  }
@@ -23901,22 +23923,6 @@
23901
23923
  el.removeEventListener(type, listener);
23902
23924
  }
23903
23925
 
23904
- var replacer = function replacer() {
23905
- var known = new WeakSet();
23906
- return function (_, value) {
23907
- if (typeof value === 'object' && value !== null) {
23908
- if (known.has(value)) {
23909
- return;
23910
- }
23911
- known.add(value);
23912
- }
23913
- return value;
23914
- };
23915
- };
23916
- var stringify = function stringify(object) {
23917
- return JSON.stringify(object, replacer());
23918
- };
23919
-
23920
23926
  function playWithCatch(media) {
23921
23927
  media == null ? void 0 : media.play().catch(function () {
23922
23928
  /* no-op */
@@ -27319,7 +27325,7 @@
27319
27325
  };
27320
27326
  _proto5.setPAC = function setPAC(pacData) {
27321
27327
  this.logger.log(2, function () {
27322
- return 'pacData = ' + JSON.stringify(pacData);
27328
+ return 'pacData = ' + stringify(pacData);
27323
27329
  });
27324
27330
  var newRow = pacData.row - 1;
27325
27331
  if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {
@@ -27372,7 +27378,7 @@
27372
27378
  */;
27373
27379
  _proto5.setBkgData = function setBkgData(bkgData) {
27374
27380
  this.logger.log(2, function () {
27375
- return 'bkgData = ' + JSON.stringify(bkgData);
27381
+ return 'bkgData = ' + stringify(bkgData);
27376
27382
  });
27377
27383
  this.backSpace();
27378
27384
  this.setPen(bkgData);
@@ -27627,7 +27633,7 @@
27627
27633
  } else {
27628
27634
  styles.foreground = 'white';
27629
27635
  }
27630
- this.logger.log(2, 'MIDROW: ' + JSON.stringify(styles));
27636
+ this.logger.log(2, 'MIDROW: ' + stringify(styles));
27631
27637
  this.writeScreen.setPen(styles);
27632
27638
  };
27633
27639
  _proto6.outputDataUpdate = function outputDataUpdate(dispatch) {
@@ -30660,7 +30666,7 @@
30660
30666
  }
30661
30667
  });
30662
30668
  if (report.length) {
30663
- logger.warn("hls.js config: \"" + report.join('", "') + "\" setting(s) are deprecated, use \"" + policyName + "\": " + JSON.stringify(userConfig[policyName]));
30669
+ logger.warn("hls.js config: \"" + report.join('", "') + "\" setting(s) are deprecated, use \"" + policyName + "\": " + stringify(userConfig[policyName]));
30664
30670
  }
30665
30671
  });
30666
30672
  return _objectSpread2(_objectSpread2({}, defaultsCopy), userConfig);
@@ -31063,7 +31069,7 @@
31063
31069
  if (!stallReported && stalled !== null && media && hls) {
31064
31070
  // Report stalled error once
31065
31071
  this.stallReported = true;
31066
- var error = new Error("Playback stalling at @" + media.currentTime + " due to low buffer (" + JSON.stringify(bufferInfo) + ")");
31072
+ var error = new Error("Playback stalling at @" + media.currentTime + " due to low buffer (" + stringify(bufferInfo) + ")");
31067
31073
  this.warn(error.message);
31068
31074
  hls.trigger(Events.ERROR, {
31069
31075
  type: ErrorTypes.MEDIA_ERROR,
@@ -31251,7 +31257,7 @@
31251
31257
  cue.type = type;
31252
31258
  }
31253
31259
  } catch (e) {
31254
- cue = new Cue(startTime, endTime, JSON.stringify(type ? _objectSpread2({
31260
+ cue = new Cue(startTime, endTime, stringify(type ? _objectSpread2({
31255
31261
  type: type
31256
31262
  }, data) : data));
31257
31263
  }
@@ -31997,7 +32003,7 @@
31997
32003
  Promise.resolve().then(function () {
31998
32004
  if (_this3.hls) {
31999
32005
  if (data.levels.length) {
32000
- _this3.warn("One or more CODECS in variant not supported: " + JSON.stringify(data.levels[0].attrs));
32006
+ _this3.warn("One or more CODECS in variant not supported: " + stringify(data.levels[0].attrs));
32001
32007
  }
32002
32008
  var error = new Error('no level with compatible codecs found in manifest');
32003
32009
  _this3.hls.trigger(Events.ERROR, {
package/dist/hls.js.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare class AbrController extends Logger implements AbrComponentAPI {
48
48
  private getBwEstimate;
49
49
  private findBestLevel;
50
50
  set nextAutoLevel(nextLevel: number);
51
+ protected deriveNextAutoLevel(nextLevel: number): number;
51
52
  }
52
53
 
53
54
  export declare type ABRControllerConfig = {