hls.js 1.5.9-0.canary.10265 → 1.5.9-0.canary.10268

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.mjs CHANGED
@@ -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.9-0.canary.10265"}`);
515
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.9-0.canary.10268"}`);
516
516
  } catch (e) {
517
517
  /* log fn threw an exception. All logger methods are no-ops. */
518
518
  return createLogger();
@@ -9688,11 +9688,14 @@ class BaseStreamController extends TaskLoop {
9688
9688
  } = this;
9689
9689
  const fragState = fragmentTracker.getState(frag);
9690
9690
  if (fragState === FragmentState.APPENDING) {
9691
- // Lower the buffer size and try again
9691
+ // Lower the max buffer length and try again
9692
9692
  const playlistType = frag.type;
9693
9693
  const bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);
9694
9694
  const minForwardBufferLength = Math.max(frag.duration, bufferedInfo ? bufferedInfo.len : this.config.maxBufferLength);
9695
- if (this.reduceMaxBufferLength(minForwardBufferLength)) {
9695
+ // If backtracking, always remove from the tracker without reducing max buffer length
9696
+ const backtrackFragment = this.backtrackFragment;
9697
+ const backtracked = backtrackFragment ? frag.sn - backtrackFragment.sn : 0;
9698
+ if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength)) {
9696
9699
  fragmentTracker.removeFragment(frag);
9697
9700
  }
9698
9701
  } else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {
@@ -10196,10 +10199,11 @@ class BaseStreamController extends TaskLoop {
10196
10199
  reduceMaxBufferLength(threshold) {
10197
10200
  const config = this.config;
10198
10201
  const minLength = threshold || config.maxBufferLength;
10199
- if (config.maxMaxBufferLength >= minLength) {
10202
+ const reducedLength = config.maxMaxBufferLength / 2;
10203
+ if (reducedLength >= minLength) {
10200
10204
  // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
10201
- config.maxMaxBufferLength /= 2;
10202
- this.warn(`Reduce max buffer length to ${config.maxMaxBufferLength}s`);
10205
+ config.maxMaxBufferLength = reducedLength;
10206
+ this.warn(`Reduce max buffer length to ${reducedLength}s`);
10203
10207
  return true;
10204
10208
  }
10205
10209
  return false;
@@ -29024,7 +29028,7 @@ class Hls {
29024
29028
  * Get the video-dev/hls.js package version.
29025
29029
  */
29026
29030
  static get version() {
29027
- return "1.5.9-0.canary.10265";
29031
+ return "1.5.9-0.canary.10268";
29028
29032
  }
29029
29033
 
29030
29034
  /**