hls.js 1.6.0-beta.2.0.canary.10837 → 1.6.0-beta.2.0.canary.10842

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.d.mts CHANGED
@@ -2309,6 +2309,7 @@ export declare class InterstitialsController extends Logger implements NetworkCo
2309
2309
  private advanceAfterAssetEnded;
2310
2310
  private setScheduleToAssetAtTime;
2311
2311
  private setSchedulePosition;
2312
+ private advanceSchedule;
2312
2313
  private get playbackDisabled();
2313
2314
  private get primaryDetails();
2314
2315
  private get primaryLive();
package/dist/hls.d.ts CHANGED
@@ -2309,6 +2309,7 @@ export declare class InterstitialsController extends Logger implements NetworkCo
2309
2309
  private advanceAfterAssetEnded;
2310
2310
  private setScheduleToAssetAtTime;
2311
2311
  private setSchedulePosition;
2312
+ private advanceSchedule;
2312
2313
  private get playbackDisabled();
2313
2314
  private get primaryDetails();
2314
2315
  private get primaryLive();
package/dist/hls.js CHANGED
@@ -1058,7 +1058,7 @@
1058
1058
  // Some browsers don't allow to use bind on console object anyway
1059
1059
  // fallback to default if needed
1060
1060
  try {
1061
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10837");
1061
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10842");
1062
1062
  } catch (e) {
1063
1063
  /* log fn threw an exception. All logger methods are no-ops. */
1064
1064
  return createLogger();
@@ -16305,7 +16305,7 @@
16305
16305
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16306
16306
  }
16307
16307
 
16308
- var version = "1.6.0-beta.2.0.canary.10837";
16308
+ var version = "1.6.0-beta.2.0.canary.10842";
16309
16309
 
16310
16310
  // ensure the worker ends up in the bundle
16311
16311
  // If the worker should not be included this gets aliased to empty.js
@@ -19192,7 +19192,7 @@
19192
19192
  _this18.hls.trigger(Events.LIVE_BACK_BUFFER_REACHED, {
19193
19193
  bufferEnd: targetBackBufferPosition
19194
19194
  });
19195
- } else if (track != null && track.ended && buffered.end(buffered.length - 1) - currentTime < targetDuration * 2) {
19195
+ } else if (track != null && track.ended) {
19196
19196
  _this18.log("Cannot flush " + type + " back buffer while SourceBuffer is in ended state");
19197
19197
  return;
19198
19198
  }
@@ -19219,13 +19219,9 @@
19219
19219
  }
19220
19220
  var bufferStart = buffered.start(numBufferedRanges - 1);
19221
19221
  var bufferEnd = buffered.end(numBufferedRanges - 1);
19222
- var track = _this19.tracks[type];
19223
19222
  // No flush if we can tolerate the current buffer length or the current buffer range we would flush is contiguous with current position
19224
19223
  if (targetFrontBufferPosition > bufferStart || currentTime >= bufferStart && currentTime <= bufferEnd) {
19225
19224
  return;
19226
- } else if (track != null && track.ended && currentTime - bufferEnd < 2 * targetDuration) {
19227
- _this19.log("Cannot flush " + type + " front buffer while SourceBuffer is in ended state");
19228
- return;
19229
19225
  }
19230
19226
  _this19.hls.trigger(Events.BUFFER_FLUSHING, {
19231
19227
  startOffset: bufferStart,
@@ -24314,14 +24310,12 @@
24314
24310
  }
24315
24311
  };
24316
24312
  _proto.setSchedulePosition = function setSchedulePosition(index, assetListIndex) {
24317
- var _this2 = this;
24318
24313
  var scheduleItems = this.schedule.items;
24319
24314
  if (!scheduleItems || this.playbackDisabled) {
24320
24315
  return;
24321
24316
  }
24322
24317
  this.log("setSchedulePosition " + index + ", " + assetListIndex);
24323
24318
  var scheduledItem = index >= 0 ? scheduleItems[index] : null;
24324
- var media = this.primaryMedia;
24325
24319
  // Cleanup current item / asset
24326
24320
  var currentItem = this.playingItem;
24327
24321
  var playingLastItem = this.playingLastItem;
@@ -24361,15 +24355,23 @@
24361
24355
  // Exiting an Interstitial
24362
24356
  this.clearInterstitial(interstitial, scheduledItem);
24363
24357
  if (interstitial.cue.once) {
24358
+ // Remove interstitial with CUE attribute value of ONCE after it has played
24364
24359
  this.updateSchedule();
24365
- if (scheduledItem) {
24360
+ var items = this.schedule.items;
24361
+ if (scheduledItem && items) {
24366
24362
  var updatedIndex = this.schedule.findItemIndex(scheduledItem);
24367
- this.setSchedulePosition(updatedIndex, assetListIndex);
24363
+ this.advanceSchedule(updatedIndex, items, assetListIndex, currentItem, playingLastItem);
24368
24364
  }
24369
24365
  return;
24370
24366
  }
24371
24367
  }
24372
24368
  }
24369
+ this.advanceSchedule(index, scheduleItems, assetListIndex, currentItem, playingLastItem);
24370
+ };
24371
+ _proto.advanceSchedule = function advanceSchedule(index, scheduleItems, assetListIndex, currentItem, playedLastItem) {
24372
+ var _this2 = this;
24373
+ var scheduledItem = index >= 0 ? scheduleItems[index] : null;
24374
+ var media = this.primaryMedia;
24373
24375
  // Cleanup out of range Interstitials
24374
24376
  var playerQueue = this.playerQueue;
24375
24377
  if (playerQueue.length) {
@@ -24385,39 +24387,39 @@
24385
24387
  if (this.isInterstitial(scheduledItem)) {
24386
24388
  this.timelinePos = Math.min(Math.max(this.timelinePos, scheduledItem.start), scheduledItem.end);
24387
24389
  // Handle Interstitial
24388
- var _interstitial = scheduledItem.event;
24390
+ var interstitial = scheduledItem.event;
24389
24391
  // find asset index
24390
24392
  if (assetListIndex === undefined) {
24391
- assetListIndex = this.schedule.findAssetIndex(_interstitial, this.timelinePos);
24393
+ assetListIndex = this.schedule.findAssetIndex(interstitial, this.timelinePos);
24392
24394
  }
24393
24395
  // Ensure Interstitial is enqueued
24394
24396
  var waitingItem = this.waitingItem;
24395
- var _player = this.preloadAssets(_interstitial, assetListIndex);
24396
- if (!_player) {
24397
+ var player = this.preloadAssets(interstitial, assetListIndex);
24398
+ if (!player) {
24397
24399
  this.setBufferingItem(scheduledItem);
24398
24400
  }
24399
24401
  if (!this.eventItemsMatch(scheduledItem, currentItem || waitingItem)) {
24400
24402
  this.waitingItem = scheduledItem;
24401
- this.log("INTERSTITIAL_STARTED " + segmentToString(scheduledItem) + " " + (_interstitial.appendInPlace ? 'append in place' : ''));
24403
+ this.log("INTERSTITIAL_STARTED " + segmentToString(scheduledItem) + " " + (interstitial.appendInPlace ? 'append in place' : ''));
24402
24404
  this.hls.trigger(Events.INTERSTITIAL_STARTED, {
24403
- event: _interstitial,
24405
+ event: interstitial,
24404
24406
  schedule: scheduleItems.slice(0),
24405
24407
  scheduleIndex: index
24406
24408
  });
24407
24409
  }
24408
- var assetListLength = _interstitial.assetList.length;
24409
- if (assetListLength === 0 && !_interstitial.assetListResponse) {
24410
+ var assetListLength = interstitial.assetList.length;
24411
+ if (assetListLength === 0 && !interstitial.assetListResponse) {
24410
24412
  // Waiting at end of primary content segment
24411
24413
  // Expect setSchedulePosition to be called again once ASSET-LIST is loaded
24412
- this.log("Waiting for ASSET-LIST to complete loading " + _interstitial);
24414
+ this.log("Waiting for ASSET-LIST to complete loading " + interstitial);
24413
24415
  return;
24414
24416
  }
24415
- if (_interstitial.assetListLoader) {
24416
- _interstitial.assetListLoader.destroy();
24417
- _interstitial.assetListLoader = undefined;
24417
+ if (interstitial.assetListLoader) {
24418
+ interstitial.assetListLoader.destroy();
24419
+ interstitial.assetListLoader = undefined;
24418
24420
  }
24419
24421
  if (!media) {
24420
- this.log("Waiting for attachMedia to start Interstitial " + _interstitial);
24422
+ this.log("Waiting for attachMedia to start Interstitial " + interstitial);
24421
24423
  return;
24422
24424
  }
24423
24425
  // Update schedule and asset list position now that it can start
@@ -24425,40 +24427,40 @@
24425
24427
  this.playingItem = scheduledItem;
24426
24428
 
24427
24429
  // If asset-list is empty or missing asset index, advance to next item
24428
- var assetItem = _interstitial.assetList[assetListIndex];
24430
+ var assetItem = interstitial.assetList[assetListIndex];
24429
24431
  if (!assetItem) {
24430
24432
  var nextItem = scheduleItems[index + 1];
24431
24433
  var _media = this.media;
24432
24434
  if (nextItem && _media && !this.isInterstitial(nextItem) && _media.currentTime < nextItem.start) {
24433
24435
  _media.currentTime = this.timelinePos = nextItem.start;
24434
24436
  }
24435
- this.advanceAfterAssetEnded(_interstitial, index, assetListIndex || 0);
24437
+ this.advanceAfterAssetEnded(interstitial, index, assetListIndex || 0);
24436
24438
  return;
24437
24439
  }
24438
24440
 
24439
24441
  // Start Interstitial Playback
24440
- if (!_player) {
24441
- _player = this.getAssetPlayer(assetItem.identifier);
24442
+ if (!player) {
24443
+ player = this.getAssetPlayer(assetItem.identifier);
24442
24444
  }
24443
- if (_player === null || _player.destroyed) {
24444
- this.warn("asset " + (assetListIndex + 1) + "/" + assetListLength + " player destroyed " + _interstitial);
24445
- _player = this.createAssetPlayer(_interstitial, assetItem, assetListIndex);
24445
+ if (player === null || player.destroyed) {
24446
+ this.warn("asset " + (assetListIndex + 1) + "/" + assetListLength + " player destroyed " + interstitial);
24447
+ player = this.createAssetPlayer(interstitial, assetItem, assetListIndex);
24446
24448
  }
24447
24449
  if (!this.eventItemsMatch(scheduledItem, this.bufferingItem)) {
24448
- if (_interstitial.appendInPlace && this.isAssetBuffered(assetItem)) {
24450
+ if (interstitial.appendInPlace && this.isAssetBuffered(assetItem)) {
24449
24451
  return;
24450
24452
  }
24451
24453
  }
24452
- this.startAssetPlayer(_player, assetListIndex, scheduleItems, index, media);
24454
+ this.startAssetPlayer(player, assetListIndex, scheduleItems, index, media);
24453
24455
  if (this.shouldPlay) {
24454
- playWithCatch(_player.media);
24456
+ playWithCatch(player.media);
24455
24457
  }
24456
24458
  } else if (scheduledItem !== null) {
24457
24459
  this.resumePrimary(scheduledItem, index, currentItem);
24458
24460
  if (this.shouldPlay) {
24459
24461
  playWithCatch(this.hls.media);
24460
24462
  }
24461
- } else if (playingLastItem && this.isInterstitial(currentItem)) {
24463
+ } else if (playedLastItem && this.isInterstitial(currentItem)) {
24462
24464
  // Maintain playingItem state at end of schedule (setSchedulePosition(-1) called to end program)
24463
24465
  // this allows onSeeking handler to update schedule position
24464
24466
  this.playingItem = currentItem;
@@ -32881,7 +32883,7 @@
32881
32883
  };
32882
32884
  _proto.onBufferFlushed = function onBufferFlushed(event, _ref) {
32883
32885
  var type = _ref.type;
32884
- if (type !== ElementaryStreamTypes.AUDIO || this.audioOnly && !this.altAudio) {
32886
+ if (type !== ElementaryStreamTypes.AUDIO || !this.altAudio) {
32885
32887
  var mediaBuffer = (type === ElementaryStreamTypes.VIDEO ? this.videoBuffer : this.mediaBuffer) || this.media;
32886
32888
  this.afterBufferFlushed(mediaBuffer, type, PlaylistLevelType.MAIN);
32887
32889
  this.tick();
package/dist/hls.js.d.ts CHANGED
@@ -2309,6 +2309,7 @@ export declare class InterstitialsController extends Logger implements NetworkCo
2309
2309
  private advanceAfterAssetEnded;
2310
2310
  private setScheduleToAssetAtTime;
2311
2311
  private setSchedulePosition;
2312
+ private advanceSchedule;
2312
2313
  private get playbackDisabled();
2313
2314
  private get primaryDetails();
2314
2315
  private get primaryLive();