From 5842cc221e926c07cf082b225671aa3855f720b1 Mon Sep 17 00:00:00 2001 From: Rob Walch Date: Tue, 30 Jul 2024 17:04:49 -0700 Subject: [PATCH] Return live playlist end for interstitialManager primary/playout/integrated duration (cherry picked from commit 161bf44d0186a263bc82299fc09e52b913f2d2f8) --- src/controller/interstitials-controller.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/controller/interstitials-controller.ts b/src/controller/interstitials-controller.ts index 1af73543efb..34620f30f68 100644 --- a/src/controller/interstitials-controller.ts +++ b/src/controller/interstitials-controller.ts @@ -320,6 +320,13 @@ export default class InterstitialsController } return 0; }; + const getMappedDuration = (timelineType: TimelineType): number => { + if (c.primaryDetails?.live) { + // return end of last event item or playlist + return c.primaryDetails.edge; + } + return c.schedule.durations[timelineType]; + }; const seekTo = (time: number, timelineType: TimelineType) => { const item = effectivePlayingItem(); if (item?.event?.restrictions.skip) { @@ -417,7 +424,7 @@ export default class InterstitialsController return timelinePos > 0 ? timelinePos : 0; }, get duration() { - return c.schedule.durations.primary; + return getMappedDuration('primary'); }, seekTo: (time) => seekTo(time, 'primary'), }, @@ -441,7 +448,7 @@ export default class InterstitialsController ); }, get duration() { - return c.schedule.durations.playout; + return getMappedDuration('playout'); }, seekTo: (time) => seekTo(time, 'playout'), }, @@ -465,7 +472,7 @@ export default class InterstitialsController ); }, get duration() { - return c.schedule.durations.integrated; + return getMappedDuration('integrated'); }, seekTo: (time) => seekTo(time, 'integrated'), },