mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(studio): pause all media elements in iframe on seek
When seeking via the slider or timeline scrub, explicitly pause all <video> and <audio> elements inside the preview iframe. The GSAP timeline pauses but iframe media elements can continue playing independently, causing audio to keep going after a seek.
This commit is contained in:
@@ -407,6 +407,16 @@ 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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user