Skip to content

Commit 2d22144

Browse files
committed
fix(rundownTiming): account for entire playlist looping in timing calculations
1 parent e8e7787 commit 2d22144

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/webui/src/client/lib/rundownTiming.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ export class RundownTimingCalculator {
140140
let lastSegmentIds: { segmentId: SegmentId; segmentPlayoutId: SegmentPlayoutId } | undefined = undefined
141141
let nextRundownAnchor: number | undefined = undefined
142142

143+
const entirePlaylistIsLooping = isEntirePlaylistLooping(playlist)
144+
143145
if (playlist) {
144146
const breakProps = currentRundown ? this.getRundownsBeforeNextBreak(rundowns, currentRundown) : undefined
145147

@@ -509,7 +511,7 @@ export class RundownTimingCalculator {
509511
// this is a line before next line
510512
localAccum = this.linearParts[i][1] || 0
511513
// only null the values if not looping, if looping, these will be offset by the countdown for the last part
512-
if (!partsInQuickLoop[unprotectString(this.linearParts[i][0])]) {
514+
if (!partsInQuickLoop[unprotectString(this.linearParts[i][0])] && !entirePlaylistIsLooping) {
513515
this.linearParts[i][1] = null // we use null to express 'will not probably be played out, if played in order'
514516
}
515517
} else if (i === currentAIndex) {
@@ -541,7 +543,7 @@ export class RundownTimingCalculator {
541543
// this away from this line.
542544
this.linearParts[i][1] = (this.linearParts[i][1] || 0) - localAccum + currentRemaining
543545

544-
if (!partsInQuickLoop[unprotectString(this.linearParts[i][0])]) {
546+
if (!partsInQuickLoop[unprotectString(this.linearParts[i][0])] && !entirePlaylistIsLooping) {
545547
timeTillEndLoop = timeTillEndLoop ?? this.linearParts[i][1] ?? undefined
546548
}
547549

@@ -563,7 +565,7 @@ export class RundownTimingCalculator {
563565
// if timeTillEndLoop was undefined then we can assume the end of the loop is the last line in the rundown
564566
timeTillEndLoop = timeTillEndLoop ?? waitAccumulator - localAccum + currentRemaining
565567
for (let i = 0; i < nextAIndex; i++) {
566-
if (!partsInQuickLoop[unprotectString(this.linearParts[i][0])]) continue
568+
if (!partsInQuickLoop[unprotectString(this.linearParts[i][0])] && !entirePlaylistIsLooping) continue
567569

568570
// this countdown is the wait until the loop ends + whatever waits occur before this part but inside the loop
569571
this.linearParts[i][1] = timeTillEndLoop + waitInLoop

0 commit comments

Comments
 (0)