Skip to content

Commit 3492794

Browse files
committed
Fix fallback to primary on live start
Fixes #7641
1 parent 0c90903 commit 3492794

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/controller/interstitials-controller.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,16 +2747,16 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
27472747
// Fallback to Primary by on current or future events by updating schedule to skip errored interstitials/assets
27482748
const flushStart = interstitial.timelineStart;
27492749
const playingItem = this.effectivePlayingItem;
2750+
let timelinePos = this.timelinePos;
27502751
// Update schedule now that interstitial/assets are flagged with `error` for fallback
27512752
if (playingItem) {
27522753
this.log(
27532754
`Fallback to primary from event "${interstitial.identifier}" start: ${
27542755
flushStart
2755-
} pos: ${this.timelinePos} playing: ${segmentToString(
2756+
} pos: ${timelinePos} playing: ${segmentToString(
27562757
playingItem,
27572758
)} error: ${interstitial.error}`,
27582759
);
2759-
let timelinePos = this.timelinePos;
27602760
if (timelinePos === -1) {
27612761
timelinePos = this.hls.startPosition;
27622762
}
@@ -2768,14 +2768,15 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
27682768
this.attachPrimary(flushStart, null);
27692769
this.flushFrontBuffer(flushStart);
27702770
}
2771-
if (!this.schedule) {
2772-
return;
2773-
}
2774-
const scheduleIndex = this.schedule.findItemIndexAtTime(timelinePos);
2775-
this.setSchedulePosition(scheduleIndex);
2776-
} else {
2771+
} else if (timelinePos === -1) {
27772772
this.checkStart();
2773+
return;
2774+
}
2775+
if (!this.schedule) {
2776+
return;
27782777
}
2778+
const scheduleIndex = this.schedule.findItemIndexAtTime(timelinePos);
2779+
this.setSchedulePosition(scheduleIndex);
27792780
}
27802781

27812782
// Asset List loading
@@ -2828,8 +2829,9 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))} pos: ${this.timeli
28282829
const index = this.schedule.findItemIndexAtTime(this.timelinePos);
28292830
if (index !== scheduleIndex) {
28302831
interstitial.error = new Error(
2831-
`Interstitial no longer within playback range ${this.timelinePos} ${interstitial}`,
2832+
`Interstitial ${assets.length ? 'no longer within playback range' : 'asset-list is empty'} ${this.timelinePos} ${interstitial}`,
28322833
);
2834+
this.log(interstitial.error.message);
28332835
this.updateSchedule(true);
28342836
this.primaryFallback(interstitial);
28352837
return;

0 commit comments

Comments
 (0)