mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-01 19:26:52 +00:00
* fix(engine): name the data-no-timeline opt-out in the timeline-timeout warning When the sub-composition timeline wait times out, two things are emitted: the stderr line inside pollSubCompositionTimelines, which names the pending composition ids and the data-no-timeline opt-out, and the structured warning on the session, which said only "Sub-composition timelines did not become ready within 45000ms". The structured one is what a programmatic caller reads: render re-prints it in the completed_with_warnings summary and returns it in the result's `warnings` array, so a CI consumer or an SDK caller sees the symptom with no remedy attached. It also reads as a fault to diagnose, when the commonest cause is a composition that legitimately has no GSAP timeline -- CSS animations or rAF -- and is paying the full playerReadyTimeout on every render because nobody told the author the wait is theirs to switch off. The message now says the wait can be intentional, names data-no-timeline as the opt-out, and keeps the async-setup case as the other branch. The pending composition ids were already computed for the stderr line and thrown away; an optional onPending callback carries them to the session so the structured warning and its details can name them too, matching the script-failure branch, which already names its failed sources. The stderr text is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(engine): normalise the pending-id result instead of casting it The enumerate step cast `page.evaluate`'s result with `as string[]`, which is a claim the call site cannot enforce: `evaluate` is loosely typed, and anything that returns a non-array turned the cast into a TypeError thrown on the very path that exists to REPORT a problem. Normalise the result instead. `pendingCompositionIds` was also never declared on `CaptureWarning.details`, whose type is closed, so the engine build failed and every downstream package failed with it. Adds coverage for the poll's own `onPending` handoff, which the existing tests in this PR could not see: they exercised `recordSubTimelineWarning` (the message text) and never `pollSubCompositionTimelines` (where the throw was). The non-array case is the one that discriminates this fix from the tempting alternative of leaving the cast and adjusting the stubs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hyperframes/engine
Seekable web-page-to-video rendering engine built on Puppeteer and FFmpeg.
Framework-agnostic: works with GSAP, Lottie, Three.js, CSS animations, or any web content that implements the window.__hf seek protocol.
Install
npm install @hyperframes/engine
Requirements: Node.js >= 22, Chrome/Chromium (auto-downloaded by Puppeteer), FFmpeg
What it does
The engine opens your HTML composition in a headless Chrome instance, seeks frame-by-frame using Chrome's HeadlessExperimental.beginFrame API, captures screenshots, and encodes them into video with FFmpeg.
Key services
| Service | Description |
|---|---|
| browserManager | Launches and pools headless Chrome instances (chrome-headless-shell) |
| frameCapture | Manages capture sessions — seek, screenshot, buffer lifecycle |
| screenshotService | BeginFrame-based capture with CDP (Chrome DevTools Protocol) |
| chunkEncoder | FFmpeg encoding with chunked concat, GPU detection, faststart |
| streamingEncoder | Pipe frames to FFmpeg in real time (no intermediate PNGs on disk) |
| audioMixer | Parse <audio> elements and mix audio tracks via FFmpeg |
| videoFrameExtractor | Extract frames from <video> elements for compositing |
| parallelCoordinator | Split frame ranges across worker processes |
| fileServer | Serve local HTML files to the browser via Hono |
Usage
import {
acquireBrowser,
createCaptureSession,
initializeSession,
captureFrame,
closeCaptureSession,
} from "@hyperframes/engine";
// 1. Launch browser
const browserLease = await acquireBrowser({ captureMode: "beginFrame" });
// 2. Open a capture session
const session = createCaptureSession({
browser: browserLease.browser,
url: "http://localhost:3000/my-composition.html",
width: 1920,
height: 1080,
fps: 30,
});
await initializeSession(session);
// 3. Capture frames
for (let i = 0; i < totalFrames; i++) {
await captureFrame(session, i, `/tmp/frames/frame-${i}.png`);
}
// 4. Clean up
await closeCaptureSession(session);
await browserLease.release();
Most users should use @hyperframes/producer or the hyperframes CLI instead of calling the engine directly.
Documentation
Full documentation: hyperframes.heygen.com/packages/engine
Related packages
@hyperframes/core— types, parsers, frame adapters@hyperframes/producer— high-level render pipeline built on this enginehyperframes— CLI