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.
@@ -962,7 +962,6 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`,
962
962
  }
963
963
  this.log(`setSchedulePosition ${index}, ${assetListIndex}`);
964
964
  const scheduledItem = index >= 0 ? scheduleItems[index] : null;
965
- const media = this.primaryMedia;
966
965
  // Cleanup current item / asset
967
966
  const currentItem = this.playingItem;
968
967
  const playingLastItem = this.playingLastItem;
@@ -1011,15 +1010,40 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`,
1011
1010
  // Exiting an Interstitial
1012
1011
  this.clearInterstitial(interstitial, scheduledItem);
1013
1012
  if (interstitial.cue.once) {
1013
+ // Remove interstitial with CUE attribute value of ONCE after it has played
1014
1014
  this.updateSchedule();
1015
- if (scheduledItem) {
1015
+ const items = this.schedule.items;
1016
+ if (scheduledItem && items) {
1016
1017
  const updatedIndex = this.schedule.findItemIndex(scheduledItem);
1017
- this.setSchedulePosition(updatedIndex, assetListIndex);
1018
+ this.advanceSchedule(
1019
+ updatedIndex,
1020
+ items,
1021
+ assetListIndex,
1022
+ currentItem,
1023
+ playingLastItem,
1024
+ );
1018
1025
  }
1019
1026
  return;
1020
1027
  }
1021
1028
  }
1022
1029
  }
1030
+ this.advanceSchedule(
1031
+ index,
1032
+ scheduleItems,
1033
+ assetListIndex,
1034
+ currentItem,
1035
+ playingLastItem,
1036
+ );
1037
+ }
1038
+ private advanceSchedule(
1039
+ index: number,
1040
+ scheduleItems: InterstitialScheduleItem[],
1041
+ assetListIndex: number | undefined,
1042
+ currentItem: InterstitialScheduleItem | null,
1043
+ playedLastItem: boolean,
1044
+ ) {
1045
+ const scheduledItem = index >= 0 ? scheduleItems[index] : null;
1046
+ const media = this.primaryMedia;
1023
1047
  // Cleanup out of range Interstitials
1024
1048
  const playerQueue = this.playerQueue;
1025
1049
  if (playerQueue.length) {
@@ -1139,7 +1163,7 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`,
1139
1163
  if (this.shouldPlay) {
1140
1164
  playWithCatch(this.hls.media);
1141
1165
  }
1142
- } else if (playingLastItem && this.isInterstitial(currentItem)) {
1166
+ } else if (playedLastItem && this.isInterstitial(currentItem)) {
1143
1167
  // Maintain playingItem state at end of schedule (setSchedulePosition(-1) called to end program)
1144
1168
  // this allows onSeeking handler to update schedule position
1145
1169
  this.playingItem = currentItem;
@@ -1076,10 +1076,7 @@ export default class StreamController
1076
1076
  event: Events.BUFFER_FLUSHED,
1077
1077
  { type }: BufferFlushedData,
1078
1078
  ) {
1079
- if (
1080
- type !== ElementaryStreamTypes.AUDIO ||
1081
- (this.audioOnly && !this.altAudio)
1082
- ) {
1079
+ if (type !== ElementaryStreamTypes.AUDIO || !this.altAudio) {
1083
1080
  const mediaBuffer =
1084
1081
  (type === ElementaryStreamTypes.VIDEO
1085
1082
  ? this.videoBuffer