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.
This commit is contained in:
Miguel Ángel
2026-05-21 21:26:32 -04:00
parent 7b1aa23039
commit 3e7b464b3b
2 changed files with 3 additions and 11 deletions
@@ -407,16 +407,6 @@ export function useTimelinePlayer() {
if (usePlayerStore.getState().isPlaying) setIsPlaying(false);
shuttleDirectionRef.current = null;
shuttleSpeedIndexRef.current = 0;
try {
const doc = iframeRef.current?.contentDocument;
if (doc) {
for (const el of doc.querySelectorAll("video, audio")) {
(el as HTMLMediaElement).pause();
}
}
} catch {
/* cross-origin */
}
}
return true;
},
@@ -135,8 +135,10 @@ export function wrapTimeline(tl: TimelineLike): PlaybackAdapter {
play: () => tl.play(),
pause: () => tl.pause(),
seek: (t, options) => {
if (!options?.keepPlaying) tl.pause();
const shouldPause = !options?.keepPlaying;
if (shouldPause) tl.pause();
tl.seek(t);
if (shouldPause) tl.pause();
},
getTime: () => tl.time(),
getDuration: () => tl.duration(),