Skip to content

Commit 985f4f4

Browse files
authored
Merge pull request Sofie-Automation#1276 from bbc/upstream/fix-on-change-infinites-incorrect-collision-ends
fix: on change infinites incorrect collision ends
2 parents ee3e569 + bb4c22b commit 985f4f4

File tree

1 file changed

+11
-3
lines changed
  • packages/job-worker/src/playout/timeline

1 file changed

+11
-3
lines changed

packages/job-worker/src/playout/timeline/rundown.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,16 @@ function generateCurrentInfinitePieceObjects(
328328
infiniteGroup.enable.duration = infiniteInNextPart.piece.enable.duration
329329
}
330330

331-
// If this piece does not continue in the next part, then set it to end with the part it belongs to
332-
if (
331+
const pieceInstanceWithUpdatedEndCap: PieceInstanceWithTimings = { ...pieceInstance }
332+
// Give the infinite group and end cap when the end of the piece is known
333+
if (pieceInstance.resolvedEndCap) {
334+
// If the cap is a number, it is relative to the part, not the parent group so needs to be handled here
335+
if (typeof pieceInstance.resolvedEndCap === 'number') {
336+
infiniteGroup.enable.end = `#${timingContext.currentPartGroup.id}.start + ${pieceInstance.resolvedEndCap}`
337+
delete pieceInstanceWithUpdatedEndCap.resolvedEndCap
338+
}
339+
} else if (
340+
// If this piece does not continue in the next part, then set it to end with the part it belongs to
333341
!infiniteInNextPart &&
334342
currentPartInfo.partInstance.part.autoNext &&
335343
infiniteGroup.enable.duration === undefined &&
@@ -355,7 +363,7 @@ function generateCurrentInfinitePieceObjects(
355363
activePlaylist._id,
356364
infiniteGroup,
357365
nowInParent,
358-
pieceInstance,
366+
pieceInstanceWithUpdatedEndCap,
359367
pieceEnable,
360368
0,
361369
groupClasses,

0 commit comments

Comments
 (0)