hls.js 1.5.6-0.canary.10003 → 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.
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
512
512
  // Some browsers don't allow to use bind on console object anyway
513
513
  // fallback to default if needed
514
514
  try {
515
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.6-0.canary.10003"}`);
515
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.6-0.canary.10006"}`);
516
516
  } catch (e) {
517
517
  /* log fn threw an exception. All logger methods are no-ops. */
518
518
  return createLogger();
@@ -6583,8 +6583,7 @@ class AbrController extends Logger {
6583
6583
  return nextABRAutoLevel;
6584
6584
  }
6585
6585
  getAutoLevelKey() {
6586
- var _this$hls$mainForward;
6587
- return `${this.getBwEstimate()}_${(_this$hls$mainForward = this.hls.mainForwardBufferInfo) == null ? void 0 : _this$hls$mainForward.len}`;
6586
+ return `${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`;
6588
6587
  }
6589
6588
  getNextABRAutoLevel() {
6590
6589
  const {
@@ -6595,18 +6594,12 @@ class AbrController extends Logger {
6595
6594
  const {
6596
6595
  maxAutoLevel,
6597
6596
  config,
6598
- minAutoLevel,
6599
- media
6597
+ minAutoLevel
6600
6598
  } = hls;
6601
6599
  const currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;
6602
-
6603
- // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
6604
- // if we're playing back at the normal rate.
6605
- const playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
6606
6600
  const avgbw = this.getBwEstimate();
6607
6601
  // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.
6608
- const bufferInfo = hls.mainForwardBufferInfo;
6609
- const bufferStarvationDelay = (bufferInfo ? bufferInfo.len : 0) / playbackRate;
6602
+ const bufferStarvationDelay = this.getStarvationDelay();
6610
6603
  let bwFactor = config.abrBandWidthFactor;
6611
6604
  let bwUpFactor = config.abrBandWidthUpFactor;
6612
6605
 
@@ -6649,6 +6642,18 @@ class AbrController extends Logger {
6649
6642
  // or if bitrate is not lower, continue to use loadLevel
6650
6643
  return hls.loadLevel;
6651
6644
  }
6645
+ getStarvationDelay() {
6646
+ const hls = this.hls;
6647
+ const media = hls.media;
6648
+ if (!media) {
6649
+ return Infinity;
6650
+ }
6651
+ // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
6652
+ // if we're playing back at the normal rate.
6653
+ const playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
6654
+ const bufferInfo = hls.mainForwardBufferInfo;
6655
+ return (bufferInfo ? bufferInfo.len : 0) / playbackRate;
6656
+ }
6652
6657
  getBwEstimate() {
6653
6658
  return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;
6654
6659
  }
@@ -19015,15 +19020,11 @@ class StreamController extends BaseStreamController {
19015
19020
  levels,
19016
19021
  media
19017
19022
  } = this;
19018
- const {
19019
- config,
19020
- nextLoadLevel: level
19021
- } = hls;
19022
19023
 
19023
19024
  // if start level not parsed yet OR
19024
19025
  // if video not attached AND start fragment already requested OR start frag prefetch not enabled
19025
19026
  // exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment
19026
- if (levelLastLoaded === null || !media && (this.startFragRequested || !config.startFragPrefetch)) {
19027
+ if (levelLastLoaded === null || !media && (this.startFragRequested || !hls.config.startFragPrefetch)) {
19027
19028
  return;
19028
19029
  }
19029
19030
 
@@ -19031,6 +19032,7 @@ class StreamController extends BaseStreamController {
19031
19032
  if (this.altAudio && this.audioOnly) {
19032
19033
  return;
19033
19034
  }
19035
+ const level = hls.nextLoadLevel;
19034
19036
  if (!this.buffering || !(levels != null && levels[level])) {
19035
19037
  return;
19036
19038
  }
@@ -19991,7 +19993,7 @@ class Hls {
19991
19993
  * Get the video-dev/hls.js package version.
19992
19994
  */
19993
19995
  static get version() {
19994
- return "1.5.6-0.canary.10003";
19996
+ return "1.5.6-0.canary.10006";
19995
19997
  }
19996
19998
 
19997
19999
  /**