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.light.js CHANGED
@@ -493,7 +493,7 @@
493
493
  // Some browsers don't allow to use bind on console object anyway
494
494
  // fallback to default if needed
495
495
  try {
496
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.10398");
496
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.12-0.canary.10399");
497
497
  } catch (e) {
498
498
  /* log fn threw an exception. All logger methods are no-ops. */
499
499
  return createLogger();
@@ -13086,7 +13086,7 @@
13086
13086
  // If backtracking, always remove from the tracker without reducing max buffer length
13087
13087
  var backtrackFragment = this.backtrackFragment;
13088
13088
  var backtracked = backtrackFragment ? frag.sn - backtrackFragment.sn : 0;
13089
- if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength)) {
13089
+ if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength, frag.duration)) {
13090
13090
  fragmentTracker.removeFragment(frag);
13091
13091
  }
13092
13092
  } else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {
@@ -13584,10 +13584,10 @@
13584
13584
  }
13585
13585
  return Math.min(maxBufLen, config.maxMaxBufferLength);
13586
13586
  };
13587
- _proto.reduceMaxBufferLength = function reduceMaxBufferLength(threshold) {
13587
+ _proto.reduceMaxBufferLength = function reduceMaxBufferLength(threshold, fragDuration) {
13588
13588
  var config = this.config;
13589
- var minLength = threshold || config.maxBufferLength;
13590
- var reducedLength = config.maxMaxBufferLength / 2;
13589
+ var minLength = Math.max(Math.min(threshold, config.maxBufferLength), fragDuration);
13590
+ var reducedLength = Math.max(threshold - fragDuration * 3, config.maxMaxBufferLength / 2);
13591
13591
  if (reducedLength >= minLength) {
13592
13592
  // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
13593
13593
  config.maxMaxBufferLength = reducedLength;
@@ -13962,13 +13962,14 @@
13962
13962
  _proto.reduceLengthAndFlushBuffer = function reduceLengthAndFlushBuffer(data) {
13963
13963
  // if in appending state
13964
13964
  if (this.state === State.PARSING || this.state === State.PARSED) {
13965
+ var frag = data.frag;
13965
13966
  var playlistType = data.parent;
13966
13967
  var bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);
13967
13968
  // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end
13968
13969
  // reduce max buf len if current position is buffered
13969
13970
  var buffered = bufferedInfo && bufferedInfo.len > 0.5;
13970
13971
  if (buffered) {
13971
- this.reduceMaxBufferLength(bufferedInfo.len);
13972
+ this.reduceMaxBufferLength(bufferedInfo.len, (frag == null ? void 0 : frag.duration) || 10);
13972
13973
  }
13973
13974
  var flushBuffer = !buffered;
13974
13975
  if (flushBuffer) {
@@ -13977,9 +13978,9 @@
13977
13978
  // in that case flush the whole audio buffer to recover
13978
13979
  this.warn("Buffer full error while media.currentTime is not buffered, flush " + playlistType + " buffer");
13979
13980
  }
13980
- if (data.frag) {
13981
- this.fragmentTracker.removeFragment(data.frag);
13982
- this.nextLoadPosition = data.frag.start;
13981
+ if (frag) {
13982
+ this.fragmentTracker.removeFragment(frag);
13983
+ this.nextLoadPosition = frag.start;
13983
13984
  }
13984
13985
  this.resetLoadingState();
13985
13986
  return flushBuffer;
@@ -21999,7 +22000,7 @@
21999
22000
  * Get the video-dev/hls.js package version.
22000
22001
  */
22001
22002
  function get() {
22002
- return "1.5.12-0.canary.10398";
22003
+ return "1.5.12-0.canary.10399";
22003
22004
  }
22004
22005
  }, {
22005
22006
  key: "Events",