mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-05 00:56:23 +00:00
feat(runtime): apply color grading in preview and render
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user