Skip to main content
The player package provides a <hyperframes-player> custom element that embeds a HyperFrames composition in plain HTML or a framework application.
Use Player when an application needs to play and seek an HTML composition. Use Studio to edit it or the CLI and Producer to render a video file.

Embed a composition

Via CDN

index.html
With a package manager:
index.html
Set autoplay muted only when playback should start without a user gesture.

Attributes

range-start and range-end play the moment [start, end) of the film. The player parks on range-start at ready, and again when a paused playhead falls outside a new range; play() from outside the range starts there. At the end it holds the last frame before range-end and fires ended, or wraps to range-start with loop. currentTime at ended is then inside that frame, not range-end itself, so listen for ended rather than comparing times. A current runtime stops on that frame itself; video and __timelines players stop one clock tick early, predicted from the smaller of their last two steps, and a video in a background tab checks on its own timeupdate; an older runtime stops when the player sees its time pass the end. currentTime and duration stay in film time. A range past the film is cut to its end and an empty or negative one is ignored; both fire rangeclamped. Player also accepts shader-capture-scale and shader-loading for previewing projects that use shader transitions. These are preview controls, not composition authoring attributes. With a video/... type, src plays in a <video> behind the same playback API and events. scenes, setRuntimeData(), setColorGrading(), iframeElement and stopMedia() are composition-only, and srcdoc wins over a video src, as it does in an iframe.

JavaScript API

The main API follows familiar media-player behavior:

Events

Advanced: iframe access

The composition runs inside an <iframe> in the player’s Shadow DOM. For most uses, the JavaScript API and events above are enough. The iframeElement getter exists for same-origin tools that must inspect the composition DOM or connect a custom editing surface:
Direct DOM access works only when the composition and the host page are same-origin. Cross-origin embeds must use the Player API and events. @hyperframes/studio exports resolveIframe for consumers that need to pass the inner iframe to Studio’s timeline hooks:

How it works

The composition runs in a sandboxed iframe inside the player’s Shadow DOM. This isolates its styles, scales it to the player container, and lets the player communicate with the HyperFrames runtime through postMessage.