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

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.js CHANGED
@@ -644,7 +644,7 @@
644
644
  // Some browsers don't allow to use bind on console object anyway
645
645
  // fallback to default if needed
646
646
  try {
647
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.6-0.canary.10005");
647
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.6-0.canary.10008");
648
648
  } catch (e) {
649
649
  /* log fn threw an exception. All logger methods are no-ops. */
650
650
  return createLogger();
@@ -7557,8 +7557,7 @@
7557
7557
  }
7558
7558
  };
7559
7559
  _proto.getAutoLevelKey = function getAutoLevelKey() {
7560
- var _this$hls$mainForward;
7561
- return this.getBwEstimate() + "_" + ((_this$hls$mainForward = this.hls.mainForwardBufferInfo) == null ? void 0 : _this$hls$mainForward.len);
7560
+ return this.getBwEstimate() + "_" + this.getStarvationDelay().toFixed(2);
7562
7561
  };
7563
7562
  _proto.getNextABRAutoLevel = function getNextABRAutoLevel() {
7564
7563
  var fragCurrent = this.fragCurrent,
@@ -7566,17 +7565,11 @@
7566
7565
  hls = this.hls;
7567
7566
  var maxAutoLevel = hls.maxAutoLevel,
7568
7567
  config = hls.config,
7569
- minAutoLevel = hls.minAutoLevel,
7570
- media = hls.media;
7568
+ minAutoLevel = hls.minAutoLevel;
7571
7569
  var currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;
7572
-
7573
- // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
7574
- // if we're playing back at the normal rate.
7575
- var playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
7576
7570
  var avgbw = this.getBwEstimate();
7577
7571
  // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.
7578
- var bufferInfo = hls.mainForwardBufferInfo;
7579
- var bufferStarvationDelay = (bufferInfo ? bufferInfo.len : 0) / playbackRate;
7572
+ var bufferStarvationDelay = this.getStarvationDelay();
7580
7573
  var bwFactor = config.abrBandWidthFactor;
7581
7574
  var bwUpFactor = config.abrBandWidthUpFactor;
7582
7575
 
@@ -7619,6 +7612,18 @@
7619
7612
  // or if bitrate is not lower, continue to use loadLevel
7620
7613
  return hls.loadLevel;
7621
7614
  };
7615
+ _proto.getStarvationDelay = function getStarvationDelay() {
7616
+ var hls = this.hls;
7617
+ var media = hls.media;
7618
+ if (!media) {
7619
+ return Infinity;
7620
+ }
7621
+ // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
7622
+ // if we're playing back at the normal rate.
7623
+ var playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
7624
+ var bufferInfo = hls.mainForwardBufferInfo;
7625
+ return (bufferInfo ? bufferInfo.len : 0) / playbackRate;
7626
+ };
7622
7627
  _proto.getBwEstimate = function getBwEstimate() {
7623
7628
  return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;
7624
7629
  };
@@ -7682,6 +7687,9 @@
7682
7687
  if (typeof (mediaCapabilities == null ? void 0 : mediaCapabilities.decodingInfo) === 'function' && requiresMediaCapabilitiesDecodingInfo(levelInfo, audioTracksByGroup, currentVideoRange, currentFrameRate, currentBw, audioPreference)) {
7683
7688
  levelInfo.supportedPromise = getMediaDecodingInfoPromise(levelInfo, audioTracksByGroup, mediaCapabilities);
7684
7689
  levelInfo.supportedPromise.then(function (decodingInfo) {
7690
+ if (!_this2.hls) {
7691
+ return;
7692
+ }
7685
7693
  levelInfo.supportedResult = decodingInfo;
7686
7694
  var levels = _this2.hls.levels;
7687
7695
  var index = levels.indexOf(levelInfo);
@@ -28279,13 +28287,11 @@
28279
28287
  levelLastLoaded = this.levelLastLoaded,
28280
28288
  levels = this.levels,
28281
28289
  media = this.media;
28282
- var config = hls.config,
28283
- level = hls.nextLoadLevel;
28284
28290
 
28285
28291
  // if start level not parsed yet OR
28286
28292
  // if video not attached AND start fragment already requested OR start frag prefetch not enabled
28287
28293
  // exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment
28288
- if (levelLastLoaded === null || !media && (this.startFragRequested || !config.startFragPrefetch)) {
28294
+ if (levelLastLoaded === null || !media && (this.startFragRequested || !hls.config.startFragPrefetch)) {
28289
28295
  return;
28290
28296
  }
28291
28297
 
@@ -28293,6 +28299,7 @@
28293
28299
  if (this.altAudio && this.audioOnly) {
28294
28300
  return;
28295
28301
  }
28302
+ var level = hls.nextLoadLevel;
28296
28303
  if (!this.buffering || !(levels != null && levels[level])) {
28297
28304
  return;
28298
28305
  }
@@ -30091,7 +30098,7 @@
30091
30098
  * Get the video-dev/hls.js package version.
30092
30099
  */
30093
30100
  function get() {
30094
- return "1.5.6-0.canary.10005";
30101
+ return "1.5.6-0.canary.10008";
30095
30102
  }
30096
30103
  }, {
30097
30104
  key: "Events",
package/dist/hls.js.d.ts CHANGED
@@ -44,6 +44,7 @@ export declare class AbrController extends Logger implements AbrComponentAPI {
44
44
  get nextAutoLevel(): number;
45
45
  private getAutoLevelKey;
46
46
  private getNextABRAutoLevel;
47
+ private getStarvationDelay;
47
48
  private getBwEstimate;
48
49
  private findBestLevel;
49
50
  set nextAutoLevel(nextLevel: number);