Skip to content

Commit 3e7b464

Browse files
committed
fix(studio): ensure GSAP timeline stays paused after seek
Call tl.pause() both before AND after tl.seek() in the adapter. GSAP's seek() can reactivate a timeline depending on internal state; the second pause() guarantees it stays frozen at the seeked position.
1 parent 7b1aa23 commit 3e7b464

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

‎packages/studio/src/player/hooks/useTimelinePlayer.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,6 @@ export function useTimelinePlayer() {
407407
if (usePlayerStore.getState().isPlaying) setIsPlaying(false);
408408
shuttleDirectionRef.current = null;
409409
shuttleSpeedIndexRef.current = 0;
410-
try {
411-
const doc = iframeRef.current?.contentDocument;
412-
if (doc) {
413-
for (const el of doc.querySelectorAll("video, audio")) {
414-
(el as HTMLMediaElement).pause();
415-
}
416-
}
417-
} catch {
418-
/* cross-origin */
419-
}
420410
}
421411
return true;
422412
},

‎packages/studio/src/player/lib/playbackAdapter.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ export function wrapTimeline(tl: TimelineLike): PlaybackAdapter {
135135
play: () => tl.play(),
136136
pause: () => tl.pause(),
137137
seek: (t, options) => {
138-
if (!options?.keepPlaying) tl.pause();
138+
const shouldPause = !options?.keepPlaying;
139+
if (shouldPause) tl.pause();
139140
tl.seek(t);
141+
if (shouldPause) tl.pause();
140142
},
141143
getTime: () => tl.time(),
142144
getDuration: () => tl.duration(),

0 commit comments

Comments
 (0)