Files
Terence Cho 47fb33785a fix(runtime): fall back to setInterval when rAF is throttled in nested iframes
Chromium throttles requestAnimationFrame in deeply nested cross-origin
iframes — specifically the composition iframe inside an MCP widget
rendered in Claude desktop (Electron). Because the HyperFrames runtime
drives all animation by seeking GSAP on each rAF tick rather than
letting GSAP run freely, a stalled rAF loop means no animation, even
when the TransportClock is in the playing state.

Add a setInterval fallback at 16 ms alongside the primary rAF loop.
The interval is a no-op when rAF is healthy (fires within the last 100 ms);
it takes over only when rAF is starved. Interval-driven ticks do not
reschedule rAF (avoids handle accumulation), and do not update lastRafMs
(so the interval keeps firing until rAF resumes). When rAF does resume,
lastRafMs is updated and the interval goes dormant again.

Fixes autoplay and the play button in Claude desktop's MCP widget.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 20:05:52 -07:00
..
2026-05-10 18:34:43 +00:00
2026-03-21 22:43:56 -07:00
2026-03-21 22:43:56 -07:00

@hyperframes/core

Types, parsers, generators, compiler, linter, runtime, and frame adapters for the Hyperframes video framework.

Install

npm install @hyperframes/core

Most users don't need to install core directly — the CLI, producer, and studio packages depend on it internally.

What's inside

Module Description
Types TimelineElement, CompositionSpec, Asset, canvas dimensions, defaults
Parsers parseHtml — extract timeline elements from HTML; parseGsapScript — parse GSAP animations
Generators generateHyperframesHtml — produce valid Hyperframes HTML from a composition spec
Compiler compileTimingAttrs — resolve data-start / data-duration into absolute times
Linter lintHyperframeHtml — validate Hyperframes HTML (missing attributes, overlapping tracks, etc.)
Runtime IIFE script injected into the browser — manages seek, media playback, and the window.__hf protocol
Frame Adapters Pluggable animation drivers (GSAP, Lottie, CSS, or custom)

Frame Adapters

A frame adapter tells the engine how to seek your animation to a specific frame:

import { createGSAPFrameAdapter } from "@hyperframes/core";

const adapter = createGSAPFrameAdapter({
  getTimeline: () => gsap.timeline(),
  compositionId: "my-video",
});

Implement FrameAdapter for custom animation runtimes:

import type { FrameAdapter } from "@hyperframes/core";

const myAdapter: FrameAdapter = {
  id: "my-adapter",
  getDurationFrames: () => 300,
  seekFrame: (frame) => {
    /* seek your animation */
  },
};

Parsing and generating HTML

import { parseHtml, generateHyperframesHtml } from "@hyperframes/core";

const { elements, metadata } = parseHtml(htmlString);
const html = generateHyperframesHtml(spec);

Linting

import { lintHyperframeHtml } from "@hyperframes/core/lint";

const result = lintHyperframeHtml(htmlString);
// result.findings: { severity, message, elementId }[]

Documentation

Full documentation: hyperframes.heygen.com/packages/core