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.
package/dist/hls.js CHANGED
@@ -556,7 +556,7 @@
556
556
  // Some browsers don't allow to use bind on console object anyway
557
557
  // fallback to default if needed
558
558
  try {
559
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.2-0.canary.9969");
559
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.2-0.canary.9970");
560
560
  } catch (e) {
561
561
  /* log fn threw an exception. All logger methods are no-ops. */
562
562
  return createLogger();
@@ -9547,6 +9547,7 @@
9547
9547
  _this.startFragRequested = false;
9548
9548
  _this.decrypter = void 0;
9549
9549
  _this.initPTS = [];
9550
+ _this.buffering = true;
9550
9551
  _this.onMediaSeeking = function () {
9551
9552
  var _assertThisInitialize = _assertThisInitialized(_this),
9552
9553
  config = _assertThisInitialize.config,
@@ -9650,6 +9651,12 @@
9650
9651
  this.clearNextTick();
9651
9652
  this.state = State.STOPPED;
9652
9653
  };
9654
+ _proto.pauseBuffering = function pauseBuffering() {
9655
+ this.buffering = false;
9656
+ };
9657
+ _proto.resumeBuffering = function resumeBuffering() {
9658
+ this.buffering = true;
9659
+ };
9653
9660
  _proto._streamEnded = function _streamEnded(bufferInfo, levelDetails) {
9654
9661
  // If playlist is live, there is another buffered range after the current range, nothing buffered, media is detached,
9655
9662
  // of nothing loading/loaded return false
@@ -16505,12 +16512,13 @@
16505
16512
  trackId = this.trackId;
16506
16513
  var config = hls.config;
16507
16514
 
16508
- // 1. if video not attached AND
16515
+ // 1. if buffering is suspended
16516
+ // 2. if video not attached AND
16509
16517
  // start fragment already requested OR start frag prefetch not enabled
16510
- // 2. if tracks or track not loaded and selected
16518
+ // 3. if tracks or track not loaded and selected
16511
16519
  // then exit loop
16512
16520
  // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop
16513
- if (!media && (this.startFragRequested || !config.startFragPrefetch) || !(levels != null && levels[trackId])) {
16521
+ if (!this.buffering || !media && (this.startFragRequested || !config.startFragPrefetch) || !(levels != null && levels[trackId])) {
16514
16522
  return;
16515
16523
  }
16516
16524
  var levelInfo = levels[trackId];
@@ -18536,6 +18544,7 @@
18536
18544
  _this2.resetBuffer(type);
18537
18545
  });
18538
18546
  this._initSourceBuffer();
18547
+ this.hls.resumeBuffering();
18539
18548
  };
18540
18549
  _proto.resetBuffer = function resetBuffer(type) {
18541
18550
  var sb = this.sourceBuffer[type];
@@ -27494,7 +27503,7 @@
27494
27503
  if (this.altAudio && this.audioOnly) {
27495
27504
  return;
27496
27505
  }
27497
- if (!(levels != null && levels[level])) {
27506
+ if (!this.buffering || !(levels != null && levels[level])) {
27498
27507
  return;
27499
27508
  }
27500
27509
  var levelInfo = levels[level];
@@ -28472,7 +28481,6 @@
28472
28481
  this.logger = void 0;
28473
28482
  this.coreComponents = void 0;
28474
28483
  this.networkControllers = void 0;
28475
- this.started = false;
28476
28484
  this._emitter = new EventEmitter();
28477
28485
  this._autoLevelCapping = -1;
28478
28486
  this._maxHdcpLevel = null;
@@ -28703,7 +28711,6 @@
28703
28711
  startPosition = -1;
28704
28712
  }
28705
28713
  this.logger.log("startLoad(" + startPosition + ")");
28706
- this.started = true;
28707
28714
  this.networkControllers.forEach(function (controller) {
28708
28715
  controller.startLoad(startPosition);
28709
28716
  });
@@ -28714,33 +28721,30 @@
28714
28721
  */;
28715
28722
  _proto.stopLoad = function stopLoad() {
28716
28723
  this.logger.log('stopLoad');
28717
- this.started = false;
28718
28724
  this.networkControllers.forEach(function (controller) {
28719
28725
  controller.stopLoad();
28720
28726
  });
28721
28727
  }
28722
28728
 
28723
28729
  /**
28724
- * Resumes stream controller segment loading if previously started.
28730
+ * Resumes stream controller segment loading after `pauseBuffering` has been called.
28725
28731
  */;
28726
28732
  _proto.resumeBuffering = function resumeBuffering() {
28727
- if (this.started) {
28728
- this.networkControllers.forEach(function (controller) {
28729
- if ('fragmentLoader' in controller) {
28730
- controller.startLoad(-1);
28731
- }
28732
- });
28733
- }
28733
+ this.networkControllers.forEach(function (controller) {
28734
+ if (controller.resumeBuffering) {
28735
+ controller.resumeBuffering();
28736
+ }
28737
+ });
28734
28738
  }
28735
28739
 
28736
28740
  /**
28737
- * Stops stream controller segment loading without changing 'started' state like stopLoad().
28741
+ * Prevents stream controller from loading new segments until `resumeBuffering` is called.
28738
28742
  * This allows for media buffering to be paused without interupting playlist loading.
28739
28743
  */;
28740
28744
  _proto.pauseBuffering = function pauseBuffering() {
28741
28745
  this.networkControllers.forEach(function (controller) {
28742
- if ('fragmentLoader' in controller) {
28743
- controller.stopLoad();
28746
+ if (controller.pauseBuffering) {
28747
+ controller.pauseBuffering();
28744
28748
  }
28745
28749
  });
28746
28750
  }
@@ -29297,7 +29301,7 @@
29297
29301
  * Get the video-dev/hls.js package version.
29298
29302
  */
29299
29303
  function get() {
29300
- return "1.5.2-0.canary.9969";
29304
+ return "1.5.2-0.canary.9970";
29301
29305
  }
29302
29306
  }, {
29303
29307
  key: "Events",
package/dist/hls.js.d.ts CHANGED
@@ -246,6 +246,7 @@ export declare class BaseStreamController extends TaskLoop implements NetworkCom
246
246
  protected startFragRequested: boolean;
247
247
  protected decrypter: Decrypter;
248
248
  protected initPTS: RationalTimestamp[];
249
+ protected buffering: boolean;
249
250
  constructor(hls: Hls, fragmentTracker: FragmentTracker, keyLoader: KeyLoader, logPrefix: string, playlistType: PlaylistLevelType);
250
251
  protected registerListeners(): void;
251
252
  protected unregisterListeners(): void;
@@ -253,6 +254,8 @@ export declare class BaseStreamController extends TaskLoop implements NetworkCom
253
254
  protected onTickEnd(): void;
254
255
  startLoad(startPosition: number): void;
255
256
  stopLoad(): void;
257
+ pauseBuffering(): void;
258
+ resumeBuffering(): void;
256
259
  protected _streamEnded(bufferInfo: BufferInfo, levelDetails: LevelDetails): boolean;
257
260
  protected getLevelDetails(): LevelDetails | undefined;
258
261
  protected onMediaAttached(event: Events.MEDIA_ATTACHED, data: MediaAttachedData): void;
@@ -1318,7 +1321,6 @@ declare class Hls implements HlsEventEmitter {
1318
1321
  readonly logger: ILogger;
1319
1322
  private coreComponents;
1320
1323
  private networkControllers;
1321
- private started;
1322
1324
  private _emitter;
1323
1325
  private _autoLevelCapping;
1324
1326
  private _maxHdcpLevel;
@@ -1405,11 +1407,11 @@ declare class Hls implements HlsEventEmitter {
1405
1407
  */
1406
1408
  stopLoad(): void;
1407
1409
  /**
1408
- * Resumes stream controller segment loading if previously started.
1410
+ * Resumes stream controller segment loading after `pauseBuffering` has been called.
1409
1411
  */
1410
1412
  resumeBuffering(): void;
1411
1413
  /**
1412
- * Stops stream controller segment loading without changing 'started' state like stopLoad().
1414
+ * Prevents stream controller from loading new segments until `resumeBuffering` is called.
1413
1415
  * This allows for media buffering to be paused without interupting playlist loading.
1414
1416
  */
1415
1417
  pauseBuffering(): void;
@@ -2411,6 +2413,8 @@ export declare type MP4RemuxerConfig = {
2411
2413
  export declare interface NetworkComponentAPI extends ComponentAPI {
2412
2414
  startLoad(startPosition: number): void;
2413
2415
  stopLoad(): void;
2416
+ pauseBuffering?(): void;
2417
+ resumeBuffering?(): void;
2414
2418
  }
2415
2419
 
2416
2420
  export declare const enum NetworkErrorAction {