@@ -342,7 +342,34 @@ function calculateInfinitePieceEnable(
342342 }
343343
344344 let nowInParent = currentPartInfo . partTimes . nowInPart // Where is 'now' inside of the infiniteGroup?
345- if ( pieceInstance . plannedStartedPlayback !== undefined ) {
345+ if ( pieceInstance . piece . enable . isAbsolute ) {
346+ // Piece is absolute, so we should use the absolute time. This is a special case for pieces belonging to the rundown directly.
347+
348+ const infiniteGroupStart = pieceInstance . plannedStartedPlayback ?? pieceInstance . piece . enable . start
349+
350+ if ( typeof infiniteGroupStart === 'number' ) {
351+ nowInParent = currentTime - infiniteGroupStart
352+ } else {
353+ // We should never hit this, but in case start is "now"
354+ nowInParent = 0
355+ }
356+
357+ infiniteGroupEnable = { start : infiniteGroupStart }
358+ pieceEnable . start = 0
359+
360+ // nocommit prerollDuration?
361+
362+ // // If an end time has been set by a hotkey, then update the duration to be correct
363+ // if (pieceInstance.userDuration && pieceInstance.piece.enable.start !== 'now') {
364+ // if ('endRelativeToNow' in pieceInstance.userDuration) {
365+ // infiniteGroupEnable.duration =
366+ // pieceInstance.userDuration.endRelativeToNow - pieceInstance.piece.enable.start
367+ // } else {
368+ // // This should never be hit
369+ // infiniteGroupEnable.end = 'now'
370+ // }
371+ // }
372+ } else if ( pieceInstance . plannedStartedPlayback !== undefined ) {
346373 // We have a absolute start time, so we should use that.
347374 let infiniteGroupStart = pieceInstance . plannedStartedPlayback
348375 nowInParent = currentTime - pieceInstance . plannedStartedPlayback
@@ -370,31 +397,6 @@ function calculateInfinitePieceEnable(
370397 infiniteGroupEnable . end = 'now'
371398 }
372399 }
373- } else if ( pieceInstance . piece . enable . isAbsolute ) {
374- // Piece is absolute, so we should use the absolute time. This is a special case for pieces belonging to the rundown directly.
375-
376- if ( typeof pieceInstance . piece . enable . start === 'number' ) {
377- nowInParent = currentTime - pieceInstance . piece . enable . start
378- } else {
379- // We should never hit this, but in case start is "now"
380- nowInParent = 0
381- }
382-
383- infiniteGroupEnable = { start : pieceInstance . piece . enable . start }
384- pieceEnable . start = 0
385-
386- // nocommit prerollDuration?
387-
388- // // If an end time has been set by a hotkey, then update the duration to be correct
389- // if (pieceInstance.userDuration && pieceInstance.piece.enable.start !== 'now') {
390- // if ('endRelativeToNow' in pieceInstance.userDuration) {
391- // infiniteGroupEnable.duration =
392- // pieceInstance.userDuration.endRelativeToNow - pieceInstance.piece.enable.start
393- // } else {
394- // // This should never be hit
395- // infiniteGroupEnable.end = 'now'
396- // }
397- // }
398400 }
399401
400402 return {
0 commit comments