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:
Miguel Ángel
2026-05-21 21:17:11 -04:00
parent cf940326e9
commit 7b1aa23039
@@ -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;
},