Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions packages/core/src/runtime/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,33 @@ export function syncRuntimeMedia(params: {
}
const forceSync = !isPlayingVideo && params.forceSync && drift > 0.02;
if (hardSync || strictSync || forceSync) {
try {
el.currentTime = relTime;
} catch (err) {
swallow("runtime.media.site2", err);
}
if (Math.abs(el.currentTime - relTime) > 0.5 && !seekLoadRetried.has(el)) {
seekLoadRetried.add(el);
el.load();
// Skip the per-tick seek (and the `el.load()` drift-recovery retry
// below) for `<video>` elements that have a sibling
// `<img id="__render_frame_<id>__">`. The sibling is created only
// by the producer's frame-injection pipeline during render — its
// presence means the visual is painted from the `<img>` and the
// `<video>` is `visibility: hidden`. Audio is mixed by ffmpeg from
// source files in `runAudioStage`, never via Chrome's in-browser
// audio path. So the `<video>`'s `currentTime` has no observable
// effect during render, and the per-tick set just kicks Chrome's
// media pipeline for nothing. Preview is unaffected (the sibling
// only exists during render).
const skipForInjectedVideo =
el.tagName === "VIDEO" && el.id && !!document.getElementById(`__render_frame_${el.id}__`);
if (!skipForInjectedVideo) {
try {
el.currentTime = relTime;
} catch (err) {
swallow("runtime.media.site3", err);
swallow("runtime.media.site2", err);
}
if (Math.abs(el.currentTime - relTime) > 0.5 && !seekLoadRetried.has(el)) {
seekLoadRetried.add(el);
el.load();
try {
el.currentTime = relTime;
} catch (err) {
swallow("runtime.media.site3", err);
}
}
}
playRequested.delete(el);
Expand Down
Loading