MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / decodeAllImages

Function decodeAllImages

packages/engine/src/services/frameCapture.ts:836–851  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

834// uncaught error that aborts the render. Skip in-flight and broken images;
835// only force GPU upload for images that successfully loaded.
836async function decodeAllImages(page: Page): Promise<void> {
837 await page.evaluate(async () => {
838 const imgs = Array.from(document.querySelectorAll("img"));
839 await Promise.all(
840 imgs.map((img) => {
841 const ie = img as HTMLImageElement;
842 if (typeof ie.decode !== "function") return Promise.resolve();
843 // Skip still-loading images (in-flight decode() would hang) and
844 // broken images (decode() rejects, but pre-filtering is clearer
845 // than relying on the .catch).
846 if (!ie.complete || ie.naturalWidth === 0) return Promise.resolve();
847 return ie.decode().catch(() => undefined);
848 }),
849 );
850 });
851}
852
853async function applyVideoMetadataHints(
854 page: Page,

Callers 1

initializeSessionFunction · 0.85

Calls 2

evaluateMethod · 0.80
fromMethod · 0.80

Tested by

no test coverage detected