From d551be62e38380208a5e264751a12ddad0130ef5 Mon Sep 17 00:00:00 2001 From: Miguel Angel Simon Sierra Date: Mon, 23 Nov 2026 16:31:31 -0500 Subject: [PATCH 1/2] fix(core): a held clip shows its own frame, not black, while its lighter copy is made --- packages/core/src/runtime/mediaProxy.test.ts | 35 ++++++++++++++++++++ packages/core/src/runtime/mediaProxy.ts | 5 +-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/core/src/runtime/mediaProxy.test.ts b/packages/core/src/runtime/mediaProxy.test.ts index 7bcfeb65555..754441ac5e1 100644 --- a/packages/core/src/runtime/mediaProxy.test.ts +++ b/packages/core/src/runtime/mediaProxy.test.ts @@ -1354,6 +1354,41 @@ describe("preview quality: lighter copies of heavy files", () => { } }); + // fails without the fix: the still was asked without the lighter-copy mark, so Studio's server refused it for a + // browser-safe H.264 file (422 browser_safe_codec) and the held clip showed black for as long as its copy took. + it("stands in its own frame from the server, asked as a lighter copy's still, while it is held", async () => { + const { el } = await waitingForItsCopy(making); + const media = await import("./media"); + media.syncRuntimeMedia({ + clips: [ + { + el, + start: 0, + mediaStart: 4, + duration: 10, + end: 10, + volume: null, + playbackRate: 1, + loop: false, + sourceDuration: null, + }, + ], + timeSeconds: 1, + playing: false, + playbackRate: 1, + getCompositionDuration: () => 0, + }); + await vi.advanceTimersByTimeAsync(2_000); + + const poster = new URL(el.getAttribute("poster")!, document.baseURI); + expect([...poster.searchParams]).toEqual([ + ["hf-proxy", "h264"], + ["hf-proxy-box", "2048x1218"], + ["hf-proxy-light", "1"], + ["hf-proxy-still", "5.0"], + ]); + }); + it("is not given its file back as its clip comes due", async () => { const { el, preload } = await waitingForItsCopy(making); diff --git a/packages/core/src/runtime/mediaProxy.ts b/packages/core/src/runtime/mediaProxy.ts index a6a3fc2d23a..8d47440c57f 100644 --- a/packages/core/src/runtime/mediaProxy.ts +++ b/packages/core/src/runtime/mediaProxy.ts @@ -408,10 +408,11 @@ function showStill( originalSrc: string, variant: string, box: PreviewProxyBox | null, + light: boolean, ): void { const at = sourceTimeAtPlayhead(el); if (at === undefined || stills.has(el) || el.hasAttribute("poster")) return; - const url = new URL(appendProxyParam(originalSrc, variant, box), document.baseURI); + const url = new URL(appendProxyParam(originalSrc, variant, box, light), document.baseURI); url.searchParams.set(PREVIEW_PROXY_STILL_PARAM, at.toFixed(1)); stills.add(el); el.setAttribute("poster", url.href); @@ -546,7 +547,7 @@ async function makeCopy(el: HTMLMediaElement, job: CopyJob, scale: number | null (fraction) => noteCopy(el, "making", fraction, light), () => isActiveAtPlayhead(el), false, - light && !held ? undefined : () => showStill(el, originalSrc, variant, box), + light && !held ? undefined : () => showStill(el, originalSrc, variant, box, light), ); const wanted = live(); if (!served || !wanted) sizedBeforeCopy.delete(el); From 2338e06855411c241d0a45393d4afbd7eaed5eba Mon Sep 17 00:00:00 2001 From: Miguel Angel Simon Sierra Date: Mon, 23 Nov 2026 16:48:58 -0500 Subject: [PATCH 2/2] test(core): the held clip's still asks the auto variant like its copy --- packages/core/src/runtime/mediaProxy.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/runtime/mediaProxy.test.ts b/packages/core/src/runtime/mediaProxy.test.ts index 754441ac5e1..f33bd9f3df6 100644 --- a/packages/core/src/runtime/mediaProxy.test.ts +++ b/packages/core/src/runtime/mediaProxy.test.ts @@ -1382,7 +1382,7 @@ describe("preview quality: lighter copies of heavy files", () => { const poster = new URL(el.getAttribute("poster")!, document.baseURI); expect([...poster.searchParams]).toEqual([ - ["hf-proxy", "h264"], + ["hf-proxy", "auto"], ["hf-proxy-box", "2048x1218"], ["hf-proxy-light", "1"], ["hf-proxy-still", "5.0"],