@@ -328,7 +328,7 @@ export class KairosStateBuilder {
328328 this . #deviceState. clipPlayers [ playerId ] ,
329329 playerId ,
330330 {
331- content : content . clipPlayer ,
331+ content : patchPlayerStateForLookahead ( content . clipPlayer , timelineObj . isLookahead ) ,
332332 instance : timelineObj . instance ,
333333 mappingOptions : {
334334 framerate : mapping . framerate ,
@@ -352,7 +352,7 @@ export class KairosStateBuilder {
352352 this . #deviceState. ramRecPlayers [ playerId ] ,
353353 playerId ,
354354 {
355- content : content . ramRecPlayer ,
355+ content : patchPlayerStateForLookahead ( content . ramRecPlayer , timelineObj . isLookahead ) ,
356356 instance : timelineObj . instance ,
357357 mappingOptions : {
358358 framerate : mapping . framerate ,
@@ -396,7 +396,7 @@ export class KairosStateBuilder {
396396 this . #deviceState. soundPlayers [ playerId ] ,
397397 playerId ,
398398 {
399- content : content . soundPlayer ,
399+ content : patchPlayerStateForLookahead ( content . soundPlayer , timelineObj . isLookahead ) ,
400400 instance : timelineObj . instance ,
401401 mappingOptions : {
402402 framerate : mapping . framerate ,
@@ -411,3 +411,18 @@ export type MappingOptions = {
411411 framerate ?: number
412412 clearPlayerOnStop ?: boolean
413413}
414+
415+ function patchPlayerStateForLookahead < TClip > (
416+ playerState : TimelineContentKairosPlayerState < TClip > ,
417+ isLookahead : boolean | undefined
418+ ) : TimelineContentKairosPlayerState < TClip > {
419+ if ( ! isLookahead ) return playerState
420+
421+ return {
422+ ...playerState ,
423+ // Should always be paused in lookahead
424+ playing : false ,
425+ // If no seek, enforce it to the start to allow back to back objects with the same media
426+ seek : playerState . seek ?? 0 ,
427+ }
428+ }
0 commit comments