hls.js 1.5.2-0.canary.9969 → 1.5.2-0.canary.9970

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.
@@ -431,7 +431,7 @@ function enableLogs(debugConfig, context, id) {
431
431
  // Some browsers don't allow to use bind on console object anyway
432
432
  // fallback to default if needed
433
433
  try {
434
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.2-0.canary.9969"}`);
434
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.2-0.canary.9970"}`);
435
435
  } catch (e) {
436
436
  /* log fn threw an exception. All logger methods are no-ops. */
437
437
  return createLogger();
@@ -7245,6 +7245,7 @@ class BufferController extends Logger {
7245
7245
  this.resetBuffer(type);
7246
7246
  });
7247
7247
  this._initSourceBuffer();
7248
+ this.hls.resumeBuffering();
7248
7249
  }
7249
7250
  resetBuffer(type) {
7250
7251
  const sb = this.sourceBuffer[type];
@@ -11953,6 +11954,7 @@ class BaseStreamController extends TaskLoop {
11953
11954
  this.startFragRequested = false;
11954
11955
  this.decrypter = void 0;
11955
11956
  this.initPTS = [];
11957
+ this.buffering = true;
11956
11958
  this.onMediaSeeking = () => {
11957
11959
  const {
11958
11960
  config,
@@ -12058,6 +12060,12 @@ class BaseStreamController extends TaskLoop {
12058
12060
  this.clearNextTick();
12059
12061
  this.state = State.STOPPED;
12060
12062
  }
12063
+ pauseBuffering() {
12064
+ this.buffering = false;
12065
+ }
12066
+ resumeBuffering() {
12067
+ this.buffering = true;
12068
+ }
12061
12069
  _streamEnded(bufferInfo, levelDetails) {
12062
12070
  // If playlist is live, there is another buffered range after the current range, nothing buffered, media is detached,
12063
12071
  // of nothing loading/loaded return false
@@ -18849,7 +18857,7 @@ class StreamController extends BaseStreamController {
18849
18857
  if (this.altAudio && this.audioOnly) {
18850
18858
  return;
18851
18859
  }
18852
- if (!(levels != null && levels[level])) {
18860
+ if (!this.buffering || !(levels != null && levels[level])) {
18853
18861
  return;
18854
18862
  }
18855
18863
  const levelInfo = levels[level];
@@ -19809,7 +19817,7 @@ class Hls {
19809
19817
  * Get the video-dev/hls.js package version.
19810
19818
  */
19811
19819
  static get version() {
19812
- return "1.5.2-0.canary.9969";
19820
+ return "1.5.2-0.canary.9970";
19813
19821
  }
19814
19822
 
19815
19823
  /**
@@ -19878,7 +19886,6 @@ class Hls {
19878
19886
  this.logger = void 0;
19879
19887
  this.coreComponents = void 0;
19880
19888
  this.networkControllers = void 0;
19881
- this.started = false;
19882
19889
  this._emitter = new EventEmitter();
19883
19890
  this._autoLevelCapping = -1;
19884
19891
  this._maxHdcpLevel = null;
@@ -20093,7 +20100,6 @@ class Hls {
20093
20100
  */
20094
20101
  startLoad(startPosition = -1) {
20095
20102
  this.logger.log(`startLoad(${startPosition})`);
20096
- this.started = true;
20097
20103
  this.networkControllers.forEach(controller => {
20098
20104
  controller.startLoad(startPosition);
20099
20105
  });
@@ -20104,33 +20110,30 @@ class Hls {
20104
20110
  */
20105
20111
  stopLoad() {
20106
20112
  this.logger.log('stopLoad');
20107
- this.started = false;
20108
20113
  this.networkControllers.forEach(controller => {
20109
20114
  controller.stopLoad();
20110
20115
  });
20111
20116
  }
20112
20117
 
20113
20118
  /**
20114
- * Resumes stream controller segment loading if previously started.
20119
+ * Resumes stream controller segment loading after `pauseBuffering` has been called.
20115
20120
  */
20116
20121
  resumeBuffering() {
20117
- if (this.started) {
20118
- this.networkControllers.forEach(controller => {
20119
- if ('fragmentLoader' in controller) {
20120
- controller.startLoad(-1);
20121
- }
20122
- });
20123
- }
20122
+ this.networkControllers.forEach(controller => {
20123
+ if (controller.resumeBuffering) {
20124
+ controller.resumeBuffering();
20125
+ }
20126
+ });
20124
20127
  }
20125
20128
 
20126
20129
  /**
20127
- * Stops stream controller segment loading without changing 'started' state like stopLoad().
20130
+ * Prevents stream controller from loading new segments until `resumeBuffering` is called.
20128
20131
  * This allows for media buffering to be paused without interupting playlist loading.
20129
20132
  */
20130
20133
  pauseBuffering() {
20131
20134
  this.networkControllers.forEach(controller => {
20132
- if ('fragmentLoader' in controller) {
20133
- controller.stopLoad();
20135
+ if (controller.pauseBuffering) {
20136
+ controller.pauseBuffering();
20134
20137
  }
20135
20138
  });
20136
20139
  }