hls.js 1.5.6-0.canary.10005 → 1.5.6-0.canary.10006

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.light.js CHANGED
@@ -613,7 +613,7 @@
613
613
  // Some browsers don't allow to use bind on console object anyway
614
614
  // fallback to default if needed
615
615
  try {
616
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.6-0.canary.10005");
616
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.6-0.canary.10006");
617
617
  } catch (e) {
618
618
  /* log fn threw an exception. All logger methods are no-ops. */
619
619
  return createLogger();
@@ -6803,8 +6803,7 @@
6803
6803
  }
6804
6804
  };
6805
6805
  _proto.getAutoLevelKey = function getAutoLevelKey() {
6806
- var _this$hls$mainForward;
6807
- return this.getBwEstimate() + "_" + ((_this$hls$mainForward = this.hls.mainForwardBufferInfo) == null ? void 0 : _this$hls$mainForward.len);
6806
+ return this.getBwEstimate() + "_" + this.getStarvationDelay().toFixed(2);
6808
6807
  };
6809
6808
  _proto.getNextABRAutoLevel = function getNextABRAutoLevel() {
6810
6809
  var fragCurrent = this.fragCurrent,
@@ -6812,17 +6811,11 @@
6812
6811
  hls = this.hls;
6813
6812
  var maxAutoLevel = hls.maxAutoLevel,
6814
6813
  config = hls.config,
6815
- minAutoLevel = hls.minAutoLevel,
6816
- media = hls.media;
6814
+ minAutoLevel = hls.minAutoLevel;
6817
6815
  var currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;
6818
-
6819
- // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
6820
- // if we're playing back at the normal rate.
6821
- var playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
6822
6816
  var avgbw = this.getBwEstimate();
6823
6817
  // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.
6824
- var bufferInfo = hls.mainForwardBufferInfo;
6825
- var bufferStarvationDelay = (bufferInfo ? bufferInfo.len : 0) / playbackRate;
6818
+ var bufferStarvationDelay = this.getStarvationDelay();
6826
6819
  var bwFactor = config.abrBandWidthFactor;
6827
6820
  var bwUpFactor = config.abrBandWidthUpFactor;
6828
6821
 
@@ -6865,6 +6858,18 @@
6865
6858
  // or if bitrate is not lower, continue to use loadLevel
6866
6859
  return hls.loadLevel;
6867
6860
  };
6861
+ _proto.getStarvationDelay = function getStarvationDelay() {
6862
+ var hls = this.hls;
6863
+ var media = hls.media;
6864
+ if (!media) {
6865
+ return Infinity;
6866
+ }
6867
+ // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
6868
+ // if we're playing back at the normal rate.
6869
+ var playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
6870
+ var bufferInfo = hls.mainForwardBufferInfo;
6871
+ return (bufferInfo ? bufferInfo.len : 0) / playbackRate;
6872
+ };
6868
6873
  _proto.getBwEstimate = function getBwEstimate() {
6869
6874
  return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;
6870
6875
  };
@@ -19513,13 +19518,11 @@
19513
19518
  levelLastLoaded = this.levelLastLoaded,
19514
19519
  levels = this.levels,
19515
19520
  media = this.media;
19516
- var config = hls.config,
19517
- level = hls.nextLoadLevel;
19518
19521
 
19519
19522
  // if start level not parsed yet OR
19520
19523
  // if video not attached AND start fragment already requested OR start frag prefetch not enabled
19521
19524
  // exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment
19522
- if (levelLastLoaded === null || !media && (this.startFragRequested || !config.startFragPrefetch)) {
19525
+ if (levelLastLoaded === null || !media && (this.startFragRequested || !hls.config.startFragPrefetch)) {
19523
19526
  return;
19524
19527
  }
19525
19528
 
@@ -19527,6 +19530,7 @@
19527
19530
  if (this.altAudio && this.audioOnly) {
19528
19531
  return;
19529
19532
  }
19533
+ var level = hls.nextLoadLevel;
19530
19534
  if (!this.buffering || !(levels != null && levels[level])) {
19531
19535
  return;
19532
19536
  }
@@ -21325,7 +21329,7 @@
21325
21329
  * Get the video-dev/hls.js package version.
21326
21330
  */
21327
21331
  function get() {
21328
- return "1.5.6-0.canary.10005";
21332
+ return "1.5.6-0.canary.10006";
21329
21333
  }
21330
21334
  }, {
21331
21335
  key: "Events",