fix(studio): preserve alpha proxy playback (#2625)

* fix(studio): preserve alpha proxy playback

* test(cli): pin VP8 alpha proxy pre-resolution

* fix(studio): emit textarea field-sizing CSS

* test(studio): verify textarea CSS generation
This commit is contained in:
Miguel Ángel
2026-07-17 21:56:27 -04:00
committed by GitHub
parent bcdb90a45f
commit e64a22893a
15 changed files with 125 additions and 88 deletions
+4 -4
View File
@@ -174,7 +174,7 @@ describe("maybeProxyProactively", () => {
expect(postRuntimeMessageMock).not.toHaveBeenCalled();
});
it("swaps an alpha-bearing hostile entry to a VP9 proxy", () => {
it("swaps an alpha-bearing hostile entry to a VP8 proxy", () => {
window.__HF_MEDIA_CODEC_MAP__ = {
"/video.mov": {
codecName: "prores",
@@ -188,7 +188,7 @@ describe("maybeProxyProactively", () => {
maybeProxyProactively(el);
expect(proxyVariant(el)).toBe("vp9");
expect(proxyVariant(el)).toBe("vp8");
expect(el.load).toHaveBeenCalledTimes(1);
});
@@ -237,7 +237,7 @@ describe("handleMetadataForProxy (reactive trigger)", () => {
expect(postRuntimeMessageMock).not.toHaveBeenCalled();
});
it("swaps a mapped alpha entry to a VP9 proxy", () => {
it("swaps a mapped alpha entry to a VP8 proxy", () => {
window.__HF_MEDIA_CODEC_MAP__ = {
"/video.mov": {
codecName: "prores",
@@ -251,7 +251,7 @@ describe("handleMetadataForProxy (reactive trigger)", () => {
handleMetadataForProxy(el);
expect(proxyVariant(el)).toBe("vp9");
expect(proxyVariant(el)).toBe("vp8");
expect(el.load).toHaveBeenCalledTimes(1);
});
+3 -3
View File
@@ -15,7 +15,7 @@ export type MediaCodecMapEntry = {
codecName: string;
browserHostile: boolean;
representativeMime: string | null;
/** Source carries an alpha channel and therefore needs a VP9/WebM proxy.
/** Source carries an alpha channel and therefore needs a VP8/WebM proxy.
* Optional so pre-alpha-aware maps stay assignable; absent means "no alpha detected". */
hasAlpha?: boolean;
};
@@ -163,7 +163,7 @@ function lookupCodecMapEntry(
function appendProxyParam(src: string, entry: MediaCodecMapEntry | null): string {
const url = new URL(src, document.baseURI);
url.searchParams.set(PROXY_QUERY_PARAM, entry ? (entry.hasAlpha ? "vp9" : "h264") : "auto");
url.searchParams.set(PROXY_QUERY_PARAM, entry ? (entry.hasAlpha ? "vp8" : "h264") : "auto");
return url.href;
}
@@ -291,7 +291,7 @@ export function maybeProxyProactively(el: HTMLMediaElement): void {
* auto-proxying is enabled and served, so its absence means a `?hf-proxy=`
* request would 404 — never swap there. When the map is present but has no
* entry for this key, swapping stays allowed (unlisted-asset rescue). A
* mapped alpha entries select the VP9/WebM proxy variant.
* mapped alpha entries select the VP8/WebM proxy variant.
*/
export function handleMetadataForProxy(el: HTMLMediaElement): void {
if (isRenderMode(el)) return;