mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user