feat(runtime): apply color grading in preview and render

This commit is contained in:
ukimsanov
2026-06-16 13:41:32 -07:00
parent 8aaaaf1812
commit 1ad158d2f0
15 changed files with 1762 additions and 34 deletions
@@ -146,6 +146,25 @@ function createFrameSourceCache(
export const __testing = { createFrameSourceCache };
async function redrawRuntimeColorGrading(page: Page): Promise<void> {
await page.evaluate(async () => {
const hf = (
window as Window & {
__hf?: {
colorGrading?: { redraw?: () => unknown };
};
}
).__hf;
const redraw = hf?.colorGrading?.redraw;
if (typeof redraw !== "function") return;
try {
await Promise.resolve(redraw());
} catch {
// Optional page-side shader layer.
}
});
}
/**
* Creates a BeforeCaptureHook that injects pre-extracted video frames
* into the page, replacing native <video> elements with frame images.
@@ -226,6 +245,7 @@ export function createVideoFrameInjector(
}, time);
}
}
await redrawRuntimeColorGrading(page);
};
}