mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-05 05:37:09 +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);
|
if (usePlayerStore.getState().isPlaying) setIsPlaying(false);
|
||||||
shuttleDirectionRef.current = null;
|
shuttleDirectionRef.current = null;
|
||||||
shuttleSpeedIndexRef.current = 0;
|
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;
|
return true;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -135,8 +135,10 @@ export function wrapTimeline(tl: TimelineLike): PlaybackAdapter {
|
|||||||
play: () => tl.play(),
|
play: () => tl.play(),
|
||||||
pause: () => tl.pause(),
|
pause: () => tl.pause(),
|
||||||
seek: (t, options) => {
|
seek: (t, options) => {
|
||||||
if (!options?.keepPlaying) tl.pause();
|
const shouldPause = !options?.keepPlaying;
|
||||||
|
if (shouldPause) tl.pause();
|
||||||
tl.seek(t);
|
tl.seek(t);
|
||||||
|
if (shouldPause) tl.pause();
|
||||||
},
|
},
|
||||||
getTime: () => tl.time(),
|
getTime: () => tl.time(),
|
||||||
getDuration: () => tl.duration(),
|
getDuration: () => tl.duration(),
|
||||||
|
|||||||
Reference in New Issue
Block a user