Files
hyperframes/packages/core
Robin Ebers 120689e3c7 fix(player): stop the preview reloading itself after a quick seek, and stalling at cuts on a slower connection (#8339)
* fix(core): a fast seek no longer starts a preview reload loop

A seek to a clip the preload window called far loaded that clip behind the
window's back. The far-clip handler released it on its first metadata with
preload still "auto", so it loaded again: one wasted reload per seek, and
after two quick seeks or a fast scrub a loop on every clip the replaced seek
had touched, hundreds of reloads a second until the page closed.

A pending seek now owns the media window. When it starts, the clips it lands
on count as near, and the clips its destination does not need are let go,
along with the next takes they had armed, so their requests stop holding the
connection the destination loads over. Window passes leave media to the seek
until it commits. A clip the far-clip handler releases gets preload "none"
first, so it stays unloaded.

* fix(core): clips that are not playing let go of their requests, so plain play never freezes on a cut

Idle and paused clips no longer hold a connection open, and when the preview
waits for data the clips it paused release their open requests too, so the
wait always ends.

Upcoming clips load at preload metadata only in Chromium, where an idle
clip's unread bytes hold the connection's shared flow-control window.
Firefox and Safari keep buffering them ahead, which plays a film over a
slow link faster there.

* fix(core): a hold for data leaves the clip it waits for alone, and a seek during it stays put

A hold now reloads only the played clips it is not waiting for, so a clip
that stalls mid-play keeps its buffer and its picture. A clip the hold
reloaded goes back to the hold's time only while that same hold still
waits for it, so a seek made in between is not undone.

* test(core): every Chromium browser prefetches at preload metadata, Chrome on iOS does not
2026-11-21 16:02:26 +00:00
..
2026-11-21 08:25:09 +00: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)

Generated composition trust

Composition generators require trusted authors for code-bearing inputs. styles and generateHyperframesStyles preserve authored CSS, which can load external resources. animations may contain __raw: values that are emitted as JavaScript; includeScripts: true includes executable timeline code. serializeGsapAnimations also accepts raw preamble, postamble, and a code-bearing timelineVar. Never fill these inputs with untrusted data. Attribute encoding and closing-tag containment are not a sandbox; render untrusted compositions in an appropriately isolated execution environment and never serve them on a privileged origin.

Text content retains the supported inline-formatting sanitizer contract. The clip parser intentionally flattens inner formatting to text, so parse/generate is not a lossless replacement for editing the source HTML.

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