hls.js 1.5.6-0.canary.9999 → 1.5.7-0.canary.10014

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.9999");
647
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.7-0.canary.10014");
648
648
  } catch (e) {
649
649
  /* log fn threw an exception. All logger methods are no-ops. */
650
650
  return createLogger();
@@ -1871,11 +1871,13 @@
1871
1871
  var earliestPresentationTime = 0;
1872
1872
  var firstOffset = 0;
1873
1873
  if (version === 0) {
1874
- earliestPresentationTime = readUint32(sidx, index += 4);
1875
- firstOffset = readUint32(sidx, index += 4);
1874
+ earliestPresentationTime = readUint32(sidx, index);
1875
+ firstOffset = readUint32(sidx, index + 4);
1876
+ index += 8;
1876
1877
  } else {
1877
- earliestPresentationTime = readUint64(sidx, index += 8);
1878
- firstOffset = readUint64(sidx, index += 8);
1878
+ earliestPresentationTime = readUint64(sidx, index);
1879
+ firstOffset = readUint64(sidx, index + 8);
1880
+ index += 16;
1879
1881
  }
1880
1882
 
1881
1883
  // skip reserved
@@ -7557,8 +7559,7 @@
7557
7559
  }
7558
7560
  };
7559
7561
  _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);
7562
+ return this.getBwEstimate() + "_" + this.getStarvationDelay().toFixed(2);
7562
7563
  };
7563
7564
  _proto.getNextABRAutoLevel = function getNextABRAutoLevel() {
7564
7565
  var fragCurrent = this.fragCurrent,
@@ -7566,17 +7567,11 @@
7566
7567
  hls = this.hls;
7567
7568
  var maxAutoLevel = hls.maxAutoLevel,
7568
7569
  config = hls.config,
7569
- minAutoLevel = hls.minAutoLevel,
7570
- media = hls.media;
7570
+ minAutoLevel = hls.minAutoLevel;
7571
7571
  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
7572
  var avgbw = this.getBwEstimate();
7577
7573
  // 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;
7574
+ var bufferStarvationDelay = this.getStarvationDelay();
7580
7575
  var bwFactor = config.abrBandWidthFactor;
7581
7576
  var bwUpFactor = config.abrBandWidthUpFactor;
7582
7577
 
@@ -7619,6 +7614,18 @@
7619
7614
  // or if bitrate is not lower, continue to use loadLevel
7620
7615
  return hls.loadLevel;
7621
7616
  };
7617
+ _proto.getStarvationDelay = function getStarvationDelay() {
7618
+ var hls = this.hls;
7619
+ var media = hls.media;
7620
+ if (!media) {
7621
+ return Infinity;
7622
+ }
7623
+ // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as
7624
+ // if we're playing back at the normal rate.
7625
+ var playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;
7626
+ var bufferInfo = hls.mainForwardBufferInfo;
7627
+ return (bufferInfo ? bufferInfo.len : 0) / playbackRate;
7628
+ };
7622
7629
  _proto.getBwEstimate = function getBwEstimate() {
7623
7630
  return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;
7624
7631
  };
@@ -7682,6 +7689,9 @@
7682
7689
  if (typeof (mediaCapabilities == null ? void 0 : mediaCapabilities.decodingInfo) === 'function' && requiresMediaCapabilitiesDecodingInfo(levelInfo, audioTracksByGroup, currentVideoRange, currentFrameRate, currentBw, audioPreference)) {
7683
7690
  levelInfo.supportedPromise = getMediaDecodingInfoPromise(levelInfo, audioTracksByGroup, mediaCapabilities);
7684
7691
  levelInfo.supportedPromise.then(function (decodingInfo) {
7692
+ if (!_this2.hls) {
7693
+ return;
7694
+ }
7685
7695
  levelInfo.supportedResult = decodingInfo;
7686
7696
  var levels = _this2.hls.levels;
7687
7697
  var index = levels.indexOf(levelInfo);
@@ -28279,13 +28289,11 @@
28279
28289
  levelLastLoaded = this.levelLastLoaded,
28280
28290
  levels = this.levels,
28281
28291
  media = this.media;
28282
- var config = hls.config,
28283
- level = hls.nextLoadLevel;
28284
28292
 
28285
28293
  // if start level not parsed yet OR
28286
28294
  // if video not attached AND start fragment already requested OR start frag prefetch not enabled
28287
28295
  // 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)) {
28296
+ if (levelLastLoaded === null || !media && (this.startFragRequested || !hls.config.startFragPrefetch)) {
28289
28297
  return;
28290
28298
  }
28291
28299
 
@@ -28293,7 +28301,8 @@
28293
28301
  if (this.altAudio && this.audioOnly) {
28294
28302
  return;
28295
28303
  }
28296
- if (!this.buffering || !(levels != null && levels[level])) {
28304
+ var level = hls.nextLoadLevel;
28305
+ if (!(levels != null && levels[level])) {
28297
28306
  return;
28298
28307
  }
28299
28308
  var levelInfo = levels[level];
@@ -30091,7 +30100,7 @@
30091
30100
  * Get the video-dev/hls.js package version.
30092
30101
  */
30093
30102
  function get() {
30094
- return "1.5.6-0.canary.9999";
30103
+ return "1.5.7-0.canary.10014";
30095
30104
  }
30096
30105
  }, {
30097
30106
  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);