<hyperframes-player> custom element that embeds a
HyperFrames composition in plain HTML or a framework application.
Embed a composition
Via CDN
index.html
index.html
autoplay muted only when playback should start without a user gesture.
Add or remove controls at any time. When shown, the controls reflect the current
playback state, position and speed.
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.
The fullscreen button fills the screen with the whole player, controls included. It appears only where the page can go fullscreen, so not on iPhone Safari and not inside a cross-origin iframe without allow="fullscreen". It follows every exit, including Esc. Set disable-fullscreen to hide it. A refused request fires the browser’s fullscreenerror on the player.
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.
Removing a video player’s src attribute or setting it to an empty string unloads the film and resets playback to paused at 0:00. Set a new src to load another video.
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:
@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 throughpostMessage.