fix(adapter-hyperframes): inject Hyperframes runtime before page.goto() so data-composition-src templates render#18
Conversation
Templates using data-composition-src (10 of 21) render blank MP4 because the Hyperframes runtime that interprets the attribute is never injected. - Resolve hyperframes/dist/hyperframe-runtime.js via createRequire - Inject via page.addInitScript() before page.goto() - Graceful fallback when hyperframes peer dep is not installed - Update file header comment to reflect runtime injection step Fixes nexu-io#16
|
Thanks @522700967-wq for doing the end-to-end verification and writing it up so concretely. The @249469326i-lang, please take that path into the next revision together with the regression check around a |
|
Thanks for taking a look and requesting review. I’m happy to adjust the implementation if needed. For context, this PR fixes the blank MP4 output for templates using data-composition-src by injecting the Hyperframes runtime before page.goto(). I also verified that tsc -p packages/adapter-hyperframes/tsconfig.json --noEmit passes and inline-only templates remain unaffected. |
|
Thanks for the clarification, @249469326i-lang. At this point I wouldn't ask you to keep iterating on this branch: the broader fix has already landed on So there’s nothing more you need to adjust here unless you want to open a fresh follow-up for something that #22 still misses. For this branch specifically, we’ll treat it as overtaken by the merged fix. |
|
Thanks for the clarification and for taking the time to review this PR. I’m glad the issue has been addressed by the broader fix in #22. I appreciate the feedback and will keep an eye out for any remaining gaps where I can contribute in the future. Thanks again! |
…-end Add @html-video/adapter-remotion, the first cross-paradigm backend after hyperframes: deterministic frame-by-frame rendering via @remotion/renderer, bridging existing HTML/CSS/GSAP frames onto Remotion's frame clock through an iframe-srcdoc time-driver. Peer deps are optional — the CLI registers the engine only when Remotion is installed, so a bare checkout never lists an engine that would throw. The adapter was written but unverified; end-to-end render testing surfaced two stacked bugs that produced all-black output (DOM correct, pixels 0,0,0): 1. Seek timing — HtmlFrameDriver opened a single delayRender on mount, so only the first frame was synced; later frames screenshotted before the async re-seek landed. Fixed with a per-frame delayRender, a tightened ready check (require registered animations / non-empty body, not just readyState), and a rAF settle before continueRender. 2. Render-blocking external resources — a template's <link rel=stylesheet> to Google Fonts kept the srcdoc iframe from painting in headless chromium and never resolved, so Remotion captured black frames. neutralizeBlockingResources converts blocking external stylesheets to non-blocking async loads (media="print" + onload swap); fonts apply if they arrive, CSS fallback renders otherwise, paint is never blocked. (Same family as the file:// fetch issue in nexu-io#16/nexu-io#18.) Verified by rendering real templates and measuring pixels (ImageMagick): the animation template frame-bold-signal now renders at ~15→23% luminance matching the hyperframes control's 24.8% (was 0% black across the whole clip); three further diverse templates render non-black. Adds 8 unit tests for neutralizeBlockingResources. Full workspace build + tests green. Also lands RFC-08 (Remotion adapter spec) and RFC-09 (multi-engine product/UX). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Fixes #16 — 10 of 21 shipped templates use
data-composition-srcto load content fromcompositions/*.html. This attribute requires the Hyperframes runtime to be injected before page load. Without it, the resulting MP4 is completely blank/white.Changes
createRequire(ESM-safe, since hyperframes is a CJS peer dep)page.addInitScript({ path })beforepage.goto()Affected templates (verified via grep)
Verification
tsc -p packages/adapter-hyperframes/tsconfig.json --noEmitpasses ✅Testing
Hyperframes is an optional peer dep — users who have it installed will get the runtime injected; users who don't will continue to render inline templates as before.