Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/engine/src/services/frameCapture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,17 @@ export async function initializeSession(session: CaptureSession): Promise<void>
await initTransparentBackground(session.page);
}

// Warm-up seek: prime the page's render pipeline (WebGL transmission
// buffers, canvas compositing, etc.) before real frame capture begins.
// Without this, parallel workers whose first assigned frame is mid-
// animation can capture an uninitialized render state — typically a
// single flash frame with wrong 3D object orientation or missing
// transmission effects. Two seeks at different times ensure both the
// initial state and mid-animation state are primed.
await page.evaluate(`window.__hf?.seek?.(0)`);
await page.evaluate(`window.__hf?.seek?.(window.__hf?.duration * 0.5 || 0)`);
await page.evaluate(`window.__hf?.seek?.(0)`);

session.isInitialized = true;
return;
}
Expand Down Expand Up @@ -522,6 +533,11 @@ export async function initializeSession(session: CaptureSession): Promise<void>
await initTransparentBackground(session.page);
}

// Warm-up seek (same rationale as the screenshot-mode branch above).
await page.evaluate(`window.__hf?.seek?.(0)`);
await page.evaluate(`window.__hf?.seek?.(window.__hf?.duration * 0.5 || 0)`);
await page.evaluate(`window.__hf?.seek?.(0)`);

session.isInitialized = true;
}

Expand Down
Loading