hls.js 1.5.12-0.canary.10398 → 1.5.12-0.canary.10399

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
@@ -522,7 +522,7 @@
522
522
  // Some browsers don't allow to use bind on console object anyway
523
523
  // fallback to default if needed
524
524
  try {
525
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.10398");
525
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.10399");
526
526
  } catch (e) {
527
527
  /* log fn threw an exception. All logger methods are no-ops. */
528
528
  return createLogger();
@@ -10264,7 +10264,7 @@
10264
10264
  // If backtracking, always remove from the tracker without reducing max buffer length
10265
10265
  var backtrackFragment = this.backtrackFragment;
10266
10266
  var backtracked = backtrackFragment ? frag.sn - backtrackFragment.sn : 0;
10267
- if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength)) {
10267
+ if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength, frag.duration)) {
10268
10268
  fragmentTracker.removeFragment(frag);
10269
10269
  }
10270
10270
  } else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {
@@ -10762,10 +10762,10 @@
10762
10762
  }
10763
10763
  return Math.min(maxBufLen, config.maxMaxBufferLength);
10764
10764
  };
10765
- _proto.reduceMaxBufferLength = function reduceMaxBufferLength(threshold) {
10765
+ _proto.reduceMaxBufferLength = function reduceMaxBufferLength(threshold, fragDuration) {
10766
10766
  var config = this.config;
10767
- var minLength = threshold || config.maxBufferLength;
10768
- var reducedLength = config.maxMaxBufferLength / 2;
10767
+ var minLength = Math.max(Math.min(threshold, config.maxBufferLength), fragDuration);
10768
+ var reducedLength = Math.max(threshold - fragDuration * 3, config.maxMaxBufferLength / 2);
10769
10769
  if (reducedLength >= minLength) {
10770
10770
  // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
10771
10771
  config.maxMaxBufferLength = reducedLength;
@@ -11140,13 +11140,14 @@
11140
11140
  _proto.reduceLengthAndFlushBuffer = function reduceLengthAndFlushBuffer(data) {
11141
11141
  // if in appending state
11142
11142
  if (this.state === State.PARSING || this.state === State.PARSED) {
11143
+ var frag = data.frag;
11143
11144
  var playlistType = data.parent;
11144
11145
  var bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);
11145
11146
  // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end
11146
11147
  // reduce max buf len if current position is buffered
11147
11148
  var buffered = bufferedInfo && bufferedInfo.len > 0.5;
11148
11149
  if (buffered) {
11149
- this.reduceMaxBufferLength(bufferedInfo.len);
11150
+ this.reduceMaxBufferLength(bufferedInfo.len, (frag == null ? void 0 : frag.duration) || 10);
11150
11151
  }
11151
11152
  var flushBuffer = !buffered;
11152
11153
  if (flushBuffer) {
@@ -11155,9 +11156,9 @@
11155
11156
  // in that case flush the whole audio buffer to recover
11156
11157
  this.warn("Buffer full error while media.currentTime is not buffered, flush " + playlistType + " buffer");
11157
11158
  }
11158
- if (data.frag) {
11159
- this.fragmentTracker.removeFragment(data.frag);
11160
- this.nextLoadPosition = data.frag.start;
11159
+ if (frag) {
11160
+ this.fragmentTracker.removeFragment(frag);
11161
+ this.nextLoadPosition = frag.start;
11161
11162
  }
11162
11163
  this.resetLoadingState();
11163
11164
  return flushBuffer;
@@ -30787,7 +30788,7 @@
30787
30788
  * Get the video-dev/hls.js package version.
30788
30789
  */
30789
30790
  function get() {
30790
- return "1.5.12-0.canary.10398";
30791
+ return "1.5.12-0.canary.10399";
30791
30792
  }
30792
30793
  }, {
30793
30794
  key: "Events",
package/dist/hls.js.d.ts CHANGED
@@ -302,7 +302,7 @@ export declare class BaseStreamController extends TaskLoop implements NetworkCom
302
302
  protected getFwdBufferInfo(bufferable: Bufferable | null, type: PlaylistLevelType): BufferInfo | null;
303
303
  protected getFwdBufferInfoAtPos(bufferable: Bufferable | null, pos: number, type: PlaylistLevelType): BufferInfo | null;
304
304
  protected getMaxBufferLength(levelBitrate?: number): number;
305
- protected reduceMaxBufferLength(threshold: number): boolean;
305
+ protected reduceMaxBufferLength(threshold: number, fragDuration: number): boolean;
306
306
  protected getAppendedFrag(position: number, playlistType?: PlaylistLevelType): Fragment | null;
307
307
  protected getNextFragment(pos: number, levelDetails: LevelDetails): Fragment | null;
308
308
  protected isLoopLoading(frag: Fragment, targetBufferTime: number): boolean;