hls.js 1.6.0-beta.2.0.canary.10839 → 1.6.0-beta.2.0.canary.10844

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.mjs CHANGED
@@ -401,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
401
401
  // Some browsers don't allow to use bind on console object anyway
402
402
  // fallback to default if needed
403
403
  try {
404
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10839"}`);
404
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10844"}`);
405
405
  } catch (e) {
406
406
  /* log fn threw an exception. All logger methods are no-ops. */
407
407
  return createLogger();
@@ -9844,7 +9844,7 @@ var eventemitter3 = {exports: {}};
9844
9844
  var eventemitter3Exports = eventemitter3.exports;
9845
9845
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9846
9846
 
9847
- const version = "1.6.0-beta.2.0.canary.10839";
9847
+ const version = "1.6.0-beta.2.0.canary.10844";
9848
9848
 
9849
9849
  // ensure the worker ends up in the bundle
9850
9850
  // If the worker should not be included this gets aliased to empty.js
@@ -18629,7 +18629,7 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
18629
18629
  this.hls.trigger(Events.LIVE_BACK_BUFFER_REACHED, {
18630
18630
  bufferEnd: targetBackBufferPosition
18631
18631
  });
18632
- } else if (track != null && track.ended && buffered.end(buffered.length - 1) - currentTime < targetDuration * 2) {
18632
+ } else if (track != null && track.ended) {
18633
18633
  this.log(`Cannot flush ${type} back buffer while SourceBuffer is in ended state`);
18634
18634
  return;
18635
18635
  }
@@ -18653,13 +18653,9 @@ transfer tracks: ${JSON.stringify(transferredTracks, (key, value) => key === 'in
18653
18653
  }
18654
18654
  const bufferStart = buffered.start(numBufferedRanges - 1);
18655
18655
  const bufferEnd = buffered.end(numBufferedRanges - 1);
18656
- const track = this.tracks[type];
18657
18656
  // No flush if we can tolerate the current buffer length or the current buffer range we would flush is contiguous with current position
18658
18657
  if (targetFrontBufferPosition > bufferStart || currentTime >= bufferStart && currentTime <= bufferEnd) {
18659
18658
  return;
18660
- } else if (track != null && track.ended && currentTime - bufferEnd < 2 * targetDuration) {
18661
- this.log(`Cannot flush ${type} front buffer while SourceBuffer is in ended state`);
18662
- return;
18663
18659
  }
18664
18660
  this.hls.trigger(Events.BUFFER_FLUSHING, {
18665
18661
  startOffset: bufferStart,
@@ -24372,7 +24368,6 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
24372
24368
  }
24373
24369
  this.log(`setSchedulePosition ${index}, ${assetListIndex}`);
24374
24370
  const scheduledItem = index >= 0 ? scheduleItems[index] : null;
24375
- const media = this.primaryMedia;
24376
24371
  // Cleanup current item / asset
24377
24372
  const currentItem = this.playingItem;
24378
24373
  const playingLastItem = this.playingLastItem;
@@ -24412,15 +24407,22 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
24412
24407
  // Exiting an Interstitial
24413
24408
  this.clearInterstitial(interstitial, scheduledItem);
24414
24409
  if (interstitial.cue.once) {
24410
+ // Remove interstitial with CUE attribute value of ONCE after it has played
24415
24411
  this.updateSchedule();
24416
- if (scheduledItem) {
24412
+ const items = this.schedule.items;
24413
+ if (scheduledItem && items) {
24417
24414
  const updatedIndex = this.schedule.findItemIndex(scheduledItem);
24418
- this.setSchedulePosition(updatedIndex, assetListIndex);
24415
+ this.advanceSchedule(updatedIndex, items, assetListIndex, currentItem, playingLastItem);
24419
24416
  }
24420
24417
  return;
24421
24418
  }
24422
24419
  }
24423
24420
  }
24421
+ this.advanceSchedule(index, scheduleItems, assetListIndex, currentItem, playingLastItem);
24422
+ }
24423
+ advanceSchedule(index, scheduleItems, assetListIndex, currentItem, playedLastItem) {
24424
+ const scheduledItem = index >= 0 ? scheduleItems[index] : null;
24425
+ const media = this.primaryMedia;
24424
24426
  // Cleanup out of range Interstitials
24425
24427
  const playerQueue = this.playerQueue;
24426
24428
  if (playerQueue.length) {
@@ -24509,7 +24511,7 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
24509
24511
  if (this.shouldPlay) {
24510
24512
  playWithCatch(this.hls.media);
24511
24513
  }
24512
- } else if (playingLastItem && this.isInterstitial(currentItem)) {
24514
+ } else if (playedLastItem && this.isInterstitial(currentItem)) {
24513
24515
  // Maintain playingItem state at end of schedule (setSchedulePosition(-1) called to end program)
24514
24516
  // this allows onSeeking handler to update schedule position
24515
24517
  this.playingItem = currentItem;
@@ -31984,7 +31986,7 @@ class StreamController extends BaseStreamController {
31984
31986
  onBufferFlushed(event, {
31985
31987
  type
31986
31988
  }) {
31987
- if (type !== ElementaryStreamTypes.AUDIO || this.audioOnly && !this.altAudio) {
31989
+ if (type !== ElementaryStreamTypes.AUDIO || !this.altAudio) {
31988
31990
  const mediaBuffer = (type === ElementaryStreamTypes.VIDEO ? this.videoBuffer : this.mediaBuffer) || this.media;
31989
31991
  this.afterBufferFlushed(mediaBuffer, type, PlaylistLevelType.MAIN);
31990
31992
  this.tick();