* feat(player): a composition can no longer read the page that embeds the player BREAKING CHANGE: the player's composition frame no longer shares the embedding page's origin by default. Add sandbox-origin="same-origin" to keep reading the composition's DOM or runtime directly (editors, recorders, custom timelines), only for compositions you trust. * chore(skills): refresh the slideshow skill's manifest hash * fix(player): a sealed player's timeout says how to play a composition without the runtime A sealed player cannot add the runtime to a composition, so one with a GSAP timeline and no runtime never became ready and failed with a bare timeout. The timeout now names the two fixes, the README says a sealed composition brings its own runtime, and a browser test covers the sealed, trusted and runtime-bundled paths. * test(player): the heavy-films bench embeds the trusted player, since it reads the film from inside * test(player): the bench host stays sealed; only the bench that reads the film asks for trust * test(player): the perf server answers CORS, so a sealed player's film loads its own media * test(player): a sealed film on a host without CORS must still play its videos * test(core): a sealed video whose CORS load fails loads again once without crossorigin * fix(core): a sealed film's video loads once more without CORS when its host refuses CORS * fix(core): the sealed media fallback reads its event target without a realm-bound instanceof * fix(player): keep the player's origin sharing as today; sealing stays opt-in with sandbox-origin * test(core): a failed sealed media source spares its siblings; a refused URL drops the helper's CORS * fix(core): a sealed film tries every CORS source before falling back and drops CORS for refused URLs * fix(cli): the play page shares its origin as today; docs say sealing is opt-in * refactor(core): split the sealed media fallback into small steps * test(player): sealed media decides CORS per element in Chrome; probe advice follows the policy * fix(core): each sealed media element owns its CORS choice; probe advice follows the policy * test(player): a sealed player's late timeline expects the sealed advice; media cases await each read * test(player): sealed media rows for a skipped first source, author writes and a recovered URL * fix(core): sealed media falls back only when the browser has no source left, once per URL * test(player): the skipped-source row's loads are never cached, so each one is counted * test(player): the skipped-source row bounds the video's load attempts as well as its requests * test(player): sealed media rows for a mismatched-source reload, an outage and two refusing sources * fix(core): a sealed media element owns one fallback state; only a played fallback is remembered * test(player): a generated table of sealed media edits, each element checked on its own * fix(core): sealed media CORS is decided per element and chosen source, with no shared cache * test(player): the media table counts the runtime's loads against other selections * fix(core): a sealed media element guesses the source it last played * test(player): the media table attributes loads exactly and lets a failing host stay down * test: sealed media rows check per-element CORS; the generated table replaces the hand-picked ones * fix(core): a media element's own src counts as the source that failed * fix(core): starting sealed media CORS twice adds no second set of listeners * test(player): judge the sealed media table against frames without the runtime * test(player): compare the sealed media table with the same film unsealed * test(player): run the unsealed control film before the sealed one in one tab * test(player): judge an authored crossorigin only on the composition's value * test(player): an all-own list returning to an upgraded URL keeps its pixels * test(player): source and playback against the sealed film with the helper off * test(player): count every runtime load of a table video, net of the film without the helper * test(player): the all-own return row plays the other clip alone before the URL comes back * test(player): judge every round of the sealed media table, not only the end * fix(core): sealed media keeps the browser's source choice and its playback across our reloads * test(player): the table plays a video only after the runtime has bound it * fix(core): a sealed video drops a stale crossorigin its source already refused * test(player): the table exempts foreign hosts from pixels and allows a range request per load * test(core): unit rows for the source choice, down hosts and playback across reloads * refactor(core): sealed media restores time through the media clock, and its failure path is split * test(player): the table compares play() outcomes, recovers a down host, and reads a seek at seeked * test(player): the table judges a seek by where it settles and lets a composition pause on rejection * test(player): the table holds the helper to a play() the film without it resolved * test(player): pin the generated sequences that found the recovery and play() faults * test(player): a slow host keeps the composition's play() pending when its source fails * test(player): pin the sequences that find the play() and recovery faults with the slow host * test(player): the table can start its generated sequences at any seed * test(player): pin the generated sequences that find the recovered source skipped * test(player): keep the pinned sequences that are red in every run in both browsers * test(player): a looping video starting over is not a seek after the composition's * fix(core): a sealed video retries a recovered source and keeps the composition's play() alive * test(core): the playback row watches the play() the runtime's retry makes * test(player): a slow host delays its first answer only; the composition's own abort is skipped * test(player): a loop restart is told from a seek by where the seek began * test(player): restarts are read at metadata, and a buffering control judges no playback * test(player): the table counts and limits the comparisons it skips * test(player): our restore after a composition seek stays within a frame; all selections count * test(player): a playhead counts as moving if it moves within a second * fix(core): only the composition's own load() makes a sealed video retry a down source * fix(core): a sealed video's down source stays down through the runtime's preload load * test(player): judge sealed media rows by what each step makes possible, not page timing * test(player): print sealed and unsealed seek landings each sealed media run * test(player): read a looping clip after its loop restart in every film alike * fix(core): the runtime's preload loads a media element once per source list * fix(core): the runtime's prefetch shares the preload's one load per source list * test(player): a table step interrupts the CORS handling's own reload, not the runtime's preload * test(core): an undo puts a clip's colour grade back in a sealed preview in place * fix(core): an undo of a colour grade applies in place in a sealed preview * test(player): a second table seek lands during the CORS reload of a playing clip * test(core): an undo in a sealed preview keeps the media attributes the runtime added * fix(core): an undo in a sealed preview keeps the media attributes the runtime added * test(player): the playing-clip seek row plays a clip that starts past 0, as a trimmed one does * test(player): the playing-clip seek is armed with its video, before the play step waits * test(player): the down-then-back row reloads again, so every film's control has a frame * test(player): the playing-clip seek row's host answers late, so the clip plays before its reload * fix(player): a sealed player plays a same-site composition with the runtime it ships * fix(player): a switch to video unloads a sealed composition shown as srcdoc * test(core): the runtime's preload mid-selection keeps a down source's mark * fix(core): a sealed film's down source keeps its mark through the runtime's own loads * chore(player): fallow reads the cjs and iife runtime file as an entry * fix(core): declare the html-tokens subpath where package exports are generated * fix(player): a sealed composition that brings its runtime loads by src under its own headers * test(player): expect the sealed player's own timeout message in the late-runtime tests * test(core): a grade undo on a far clip whose length is loading applies in place * fix(core): a far clip's length probe records the preload it sets, so a grade undo applies * fix(player): a sealed film shown as srcdoc keeps its URL, so its sound still plays * test(player): the late-timeline switch uses a film from another origin, which must still fail * fix(player): a sealed Studio preview keeps its own runtime and loads by src * fix(player): the player package carries the runtime once, and Studio none * fix(core): a sealed video reads its own source's pixels in a list that names another host * fix(player): a sealed player with no bundler still gets the runtime, only when it needs it * fix(core): keep the mixed-list change within the comment budget * fix(core): opt a mixed list in only when its first source plays, so a reload keeps that video * fix(core): a CORS reload keeps the source that was playing * fix(core): the composition's own load() picks from its full source list again * fix(core): a reload's pin keeps a source type the composition wrote meanwhile * fix(core): a reload's pin stops at the source the browser picked, not a skipped copy of its URL * fix(core): a reload's pin stops at the source element that played, not the first copy of its URL * fix(core): a reload's pin keeps the source element that played or refused * style(core): format the source pin * style(player): keep the runtime source comment under the line limit * fix(player): only a real </script> closing tag ends a script in the runtime check * test(player): count the sealed helper's loads by the crossorigin they change * fix(player): a sealed player fails a cross-site film without the runtime exactly as unsealed * fix(core): a sealed video asks its host once before treating a failed CORS load as a refusal * test(player): the sealed table expects pixels from a host that answers CORS after a failed load * docs(player): the README's timeout sentence matches the shared error * test(core): each refusal row waits for the CORS question it starts * test(player): the sealed media table waits on each clip's own events * fix(player): a film from another site that times out names the fix, in both modes * fix(player): the no-listener warning tracks listeners by capture and drops once and aborted ones * refactor(core): a pinned-out source's error gets its own check in the sealed media helper * test(player): the loop restart wait keeps its two-second window * fix(player): warn only when no error listener ran, and leave the source URL out * fix(player): an error listener of null is passed through, as the DOM accepts it * style(player): format the table's event wait * fix(player): an onerror handler that clears itself still counts as heard * chore(fallow): resolve workspace exports to source as bun does, so no false package cycle * refactor(player): read script tag attributes in small steps, the same result * refactor(player): the shader loading attribute reads its words from one table * refactor(player): the attribute helpers' names say what their comments did * fix(core): the CORS question never follows a redirect, and stays quiet while it waits * style(core): format the CORS question's rows * test(player): a sealed same-site page keeps its own policy; a stuck fetch reports the limit * fix(player): a sealed same-site page keeps its own policy, and a stuck fetch ends at the limit * fix(player): a sealed page whose headers can't all be read, as after a redirect, loads by src * style(player): format the sealed player and name the probe's preparation state * test(player): the listener waits run past the load limit, as the cross-site wait does * fix(player): a sealed player that couldn't read its page names the runtime fix again * fix(player): a same-site page still being fetched keeps the plain timeout * test(player): a sealed player with no film gets the plain timeout
@hyperframes/player
Embeddable web component for playing HyperFrames compositions. Zero dependencies, works with any framework.
Install
npm install @hyperframes/player
Or load directly via CDN:
<script
type="module"
src="https://cdn.jsdelivr.net/npm/@hyperframes/player/dist/hyperframes-player.js"
></script>
If you need a classic <script> tag instead of ESM, use the explicit global build:
<script src="https://cdn.jsdelivr.net/npm/@hyperframes/player/dist/hyperframes-player.global.js"></script>
Usage
<hyperframes-player src="./my-composition/index.html" controls></hyperframes-player>
The player loads the composition in a sandboxed iframe, auto-detects its dimensions and duration, and scales it responsively to fit the container.
Add or remove controls at any time. When shown, the controls reflect the current playback state, position and speed. Clicking or dragging the scrubber keeps a playing film playing from the new spot, as a <video>'s own controls do, and leaves a paused film paused.
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.
With a framework
import "@hyperframes/player";
// The custom element is now registered — use it in your markup
// React: <hyperframes-player src="..." controls />
// Vue: <hyperframes-player :src="url" controls />
Video files
Set type to a video type and the player plays src in a <video playsinline> instead of loading it as a composition. The same API and events apply: play(), pause(), seek(), currentTime, duration, ready, timeupdate, play, pause, ended, durationchange and resize, with the video's own size as compositionWidth/compositionHeight. A video that fails to load fires error at once with { message, code }, where code is the MediaError code. A play() the browser blocks (for example, unmuted autoplay) fires playbackerror with { source: "video" } and leaves the player paused. poster, controls, loop, muted, volume, playback-rate and autoplay work as they do for a composition. scenes, setRuntimeData(), setColorGrading(), iframeElement and stopMedia() are composition-only: a video has no scenes or runtime, its iframe stays blank, and stopMedia() does not stop the video. srcdoc wins over a video src, as it does in an iframe.
<hyperframes-player
type="video/mp4"
src="./render.mp4"
poster="./poster.jpg"
controls
></hyperframes-player>
Removing or emptying src unloads the video and pauses it at 0:00.
Poster image
Show a static image before playback starts:
<hyperframes-player
src="./composition/index.html"
poster="./thumbnail.jpg"
controls
></hyperframes-player>
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
src |
string | — | URL to the composition HTML file, or to a video file with type |
type |
string | — | A video/... type (e.g. video/mp4) plays src as a video file |
audio-src |
string | — | Audio URL for parent-frame playback (mobile) |
width |
number | 1920 | Composition width in pixels (aspect ratio) |
height |
number | 1080 | Composition height in pixels (aspect ratio) |
controls |
boolean | false | Show play/pause, scrubber, time, volume, speed, and fullscreen controls |
muted |
boolean | false | Mute audio playback |
audio-locked |
boolean | false | Force-mute and hide the volume controls so the viewer cannot turn sound on |
poster |
string | — | Image URL shown before playback starts |
playback-rate |
number | 1 | Speed multiplier (0.5 = half, 2 = double) |
autoplay |
boolean | false | Start playing when ready |
loop |
boolean | false | Restart when the composition ends |
shader-capture-scale |
number | — | Shader transition snapshot scale forwarded to browser previews (0.25-1) |
shader-loading |
composition | player | none |
composition |
Controls shader transition prep loading UI ownership |
assets-loading-ui |
player | none |
player |
none never shows the loading-assets card; asset events still fire |
low-power-idle |
boolean | false | While paused, check in once a second, not every 80 ms (many-player pages) |
disable-click-to-play |
boolean | false | A click on the player no longer plays or pauses (host overlays own clicks) |
disable-fullscreen |
boolean | false | Hide the fullscreen button; requestFullscreen() still works |
no-load-timeout |
boolean | false | Slow loads never fail at the load limit; the page owns the deadline. Errors still fail |
range-start |
number | — | Film second where playback starts, loops back to and parks when paused |
range-end |
number | — | Film second the range ends before: it stops or loops on the frame before it |
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. A current runtime stops on that frame itself; video and __timelines players stop on their next clock tick and step back to it; 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.
Shader transition previews
When a composition uses @hyperframes/shader-transitions, the player can own preview-only shader capture settings:
<hyperframes-player
src="./composition/index.html"
shader-capture-scale="1"
shader-loading="player"
controls
></hyperframes-player>
shader-loading="player" shows the player-owned transition-prep overlay from shader progress messages. composition leaves direct composition fallback behavior alone, and none suppresses the loader.
Loading-assets card
While images, video or fonts are still loading after ready, the player shows a loading card over the frame and sets the assets-loading attribute on itself. A host that draws its own loading state can turn the card off with assets-loading-ui="none" (or player.assetsLoadingUi = "none"). The assets-loading attribute and the assetsready and painted events behave the same either way, so the host still knows when the frame is ready.
Audio lock (host-mandated silent playback)
audio-locked forces muted on and hides the volume controls, with no UI path for the viewer to turn sound back on. Use it when embedding in a chat host (Claude.ai, ChatGPT, etc.) where audio must stay off regardless of viewer intent. Setting muted directly is not enough — viewers can flip it back via the controls bar.
Removing audio-locked only unhides the controls; it does not auto-unmute. Callers manage muted explicitly after unlocking.
Host-environment fallback. Some host renderers — notably the Claude desktop Electron client — strip unknown custom-element attributes before they reach the DOM, defeating the attribute. As a safety net, the player also self-imposes the lock when it detects such an environment via navigator.userAgent, so audio stays muted even if the attribute never arrives. The public audioLocked property still reflects only the attribute, so external consumers (e.g. host widgets that mirror state) are not affected by the fallback.
Mobile audio
Mobile browsers block audio.play() inside iframes when the user gesture happened in the parent frame (the User Activation spec does not propagate activation across frame boundaries via postMessage).
The player handles this automatically for same-origin iframes (the default — sandbox includes allow-same-origin):
- When the composition is ready, the player extracts all timed media (
audio[data-start],video[data-start]) from the iframe DOM and creates parent-frame copies. - The iframe originals are disabled (
srcanddata-startremoved) so the runtime doesn't try to play them. - When
play()is called (from a user gesture), parent media.play()runs synchronously in the gesture call stack, satisfying mobile autoplay policy. - Both parent media and the GSAP timeline start simultaneously and free-run — no active sync needed since both are real-time systems.
No changes are required by consumers — this works out of the box.
A sealed player (sandbox-origin) cannot read the frame. When the frame's own play is refused, the runtime sends the player the list of clips to copy, and sends it again when it changes. The player copies only files under the composition's own folder, on its origin, with crossorigin="anonymous". Any other file is refused and named in a playbackerror event (detail.refused). A composition loaded from srcdoc has no folder of its own, so it gets no copies. The frame is muted only while a copy plays instead.
The optional audio-src attribute can be used to start preloading a primary audio track before the iframe loads (useful on slow connections), but is not required for mobile playback.
JavaScript API
const player = document.querySelector("hyperframes-player");
// Playback
player.play();
player.pause();
player.seek(2.5); // jump to 2.5 seconds and pause there
player.seek(2.5, { keepPlaying: true }); // jump, and keep playing if it was playing
// Properties
player.currentTime; // number (read/write); setting it jumps and pauses, like seek()
player.duration; // number (read-only)
player.paused; // boolean (read-only)
player.ready; // boolean (read-only)
player.compositionWidth; // number (read-only), the composition's width
player.compositionHeight; // number (read-only), the composition's height
player.disableClickToPlay; // boolean (read/write)
player.disableFullscreen; // boolean (read/write)
player.playbackRate; // number (read/write)
player.muted; // boolean (read/write)
player.audioLocked; // boolean (read/write) — force-mute + hide volume controls
player.loop; // boolean (read/write)
player.rangeStart; // number | null (read/write, mirrors range-start)
player.rangeEnd; // number | null (read/write, mirrors range-end)
player.shaderCaptureScale; // number (read/write)
player.shaderLoading; // "composition" | "player" | "none" (read/write)
// Inner iframe access (for advanced consumers — see "Advanced: iframe access" below)
player.iframeElement; // HTMLIFrameElement (read-only)
Runtime data delivery
setRuntimeData(channel, payload) clones and retains the payload, then delivers it after the
composition runtime is ready. Invalid channels and non-cloneable payloads throw synchronously.
Failures after the call returns are reported with runtimedataerror; successful application is
reported with runtimedataapplied. Both events include { channel, requestId }, and errors also
include message. Listen for both outcomes when delivery matters:
player.addEventListener("runtimedataapplied", ({ detail }) => {
console.log("applied", detail.channel, detail.requestId);
});
player.addEventListener("runtimedataerror", ({ detail }) => {
console.error("not applied", detail.channel, detail.requestId, detail.message);
});
player.setRuntimeData("captions", captionData);
Only the latest in-flight update for a channel can emit a completion. A missing runtime response,
iframe teardown, or bridge delivery failure emits runtimedataerror instead of remaining pending
indefinitely.
Advanced: iframe access
The composition runs inside a sandboxed <iframe> in the player's Shadow DOM. The default sandbox includes allow-same-origin for editor, recorder, and custom-timeline integrations that inspect the composition DOM. That is a trusted-content mode, not an isolation boundary: same-origin composition code can reach the embedding page.
For read-only or message-bridge integrations, set sandbox-origin="opaque". Any non-null value is
treated as opaque so a typo cannot weaken isolation. Changing the attribute reloads the active
composition because browser sandbox changes take effect only on navigation. Opaque mode removes
allow-same-origin while retaining scripts, and prevents the composition from reading unrelated
parent DOM. Direct contentDocument, __player, and __timelines access is intentionally
unavailable in that mode.
An opaque player adds the HyperFrames runtime itself, the version it was built with, so the embedder adds nothing. A composition from the embedding page's own site that brings the runtime loads by src as before. One without it is fetched and shown with the runtime inlined, so the frame loads nothing from another origin; inside it, location reads about:srcdoc while relative paths resolve against the composition's URL, and the embedding page's script-src policy applies to its scripts. A composition from another site loads as before and must include the runtime script.
Hosting the player's script yourself, serve the runtime file from the package's dist folder beside it: an opaque player loads it from next to its own <script>. A bundler should use the ES module build, which carries the runtime as a chunk the bundler emits; under the CommonJS build the player cannot tell where it was loaded from, and a sealed player that needs the runtime reports that it failed to load.
An opaque composition loads the videos and audio served from its own host with CORS, so colour grading, canvas reads and audio effects can use them. Serve them with Access-Control-Allow-Origin (for example *). From a host that sends no CORS headers, each one plays anyway: it is loaded again once without CORS, those effects are off for it, and the console names it.
If you are building a trusted editor integration that needs direct access, use the iframeElement getter:
const player = document.querySelector("hyperframes-player");
const iframe = player.iframeElement;
// Now you can reach into the composition's DOM and runtime
iframe.contentDocument.querySelectorAll("[data-composition-id]");
iframe.contentWindow.__timelines;
This is the canonical way to bridge the player into tools like @hyperframes/studio. The studio exports a resolveIframe helper that works with both iframe refs and web-component refs:
import { useTimelinePlayer, resolveIframe } from "@hyperframes/studio";
const { iframeRef } = useTimelinePlayer();
const player = document.createElement("hyperframes-player");
player.setAttribute("src", src);
container.appendChild(player);
// Forward the inner iframe so useTimelinePlayer can drive play/pause/seek.
iframeRef.current = resolveIframe(player);
React: declarative ref pattern
If you prefer JSX over imperative element creation, attach a ref directly to the web component and resolve the iframe inside an effect:
import "@hyperframes/player";
import type { HyperframesPlayer } from "@hyperframes/player";
import { useTimelinePlayer, resolveIframe } from "@hyperframes/studio";
function StudioPreview({ src }: { src: string }) {
const { iframeRef, onIframeLoad } = useTimelinePlayer();
const playerRef = useRef<HyperframesPlayer>(null);
useEffect(() => {
iframeRef.current = resolveIframe(playerRef.current);
});
return <hyperframes-player ref={playerRef} src={src} onLoad={onIframeLoad} />;
}
Heads up — common gotcha
If you pass the
<hyperframes-player>element itself (notiframeElement) into a hook that expects an<iframe>, every.contentWindow/.contentDocumentaccess returnsnullbecause the iframe lives inside the player's Shadow DOM. Always extractiframeElementfirst, or useresolveIframefrom@hyperframes/studiowhich handles both iframe and web-component hosts transparently.
Events
| Event | Detail | Fired when |
|---|---|---|
ready |
{ duration, compositionWidth, compositionHeight, readyMs, loadLimitMs } |
Composition loaded and duration determined; readyMs is the time from the frame's load to its timeline and loadLimitMs the load limit it had, both null for a video |
durationchange |
{ duration } |
The duration changed after ready |
resize |
{ compositionWidth, compositionHeight } |
The composition's size changed |
play |
— | Playback started |
pause |
— | Playback paused |
timeupdate |
{ currentTime } |
Playback position changed (~10 fps) |
ended |
— | Reached the end (when not looping) |
rangeclamped |
{ rangeStart, rangeEnd, duration } |
The range was cut to the film, or ignored |
error |
{ message } (video mode: { message, code }) |
Composition or video failed to load, or no timeline came within the load limit (Windows 90 s, Linux 30 s, other systems 120 s); a later timeline still fires ready |
playbackerror |
{ source, error } |
The browser blocked playback |
shadertransitionstate |
{ compositionId, state } |
Shader transition cache/capture progress |
player.addEventListener("ready", (e) => {
console.log(`Duration: ${e.detail.duration}s`);
});
player.addEventListener("ended", () => {
console.log("Done!");
});
Custom icons and loading mark
Put an element with a slot attribute inside the player to replace a control glyph or the loading mark. Anything you leave out keeps the default.
| Slot | Shown when | Default size |
|---|---|---|
play-icon |
Paused | 24 px |
pause-icon |
Playing | 24 px |
volume-high-icon |
Unmuted, volume 0.5 or higher | 20 px |
volume-low-icon |
Unmuted, volume below 0.5 | 20 px |
volume-muted-icon |
Muted | 20 px |
loading-mark |
Preparing shader transitions, loading assets, and buffering | 78 px |
<hyperframes-player src="./my-composition/index.html" controls>
<svg
slot="play-icon"
width="24"
height="24"
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
>
<path d="M8 5v14l11-7z" />
</svg>
<svg
slot="pause-icon"
width="24"
height="24"
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
>
<path d="M6 5h4v14H6zM14 5h4v14h-4z" />
</svg>
<img slot="loading-mark" src="./brand-mark.svg" width="78" height="78" alt="" />
</hyperframes-player>
Glyphs take the control bar's color through currentColor, and you set their size. Put slot on the <svg> or <img> itself, as a direct child of the player; a wrapper element needs display: contents to keep the glyph centered. A custom mark replaces the HyperFrames light sweep and glow, so add your own CSS animation if you want motion.
Until the element is defined, its children show as plain content. Hide them:
hyperframes-player:not(:defined) > [slot] {
display: none;
}
Sizing
The player fills its container and scales the composition to fit while preserving aspect ratio. Set a size on the element or its parent:
hyperframes-player {
width: 100%;
max-width: 800px;
aspect-ratio: 16 / 9;
}
The width and height attributes define the composition's native resolution for aspect ratio calculation — they don't set the player's display size.
How it works
The player renders compositions in a sandboxed <iframe> inside a Shadow DOM. It communicates with the HyperFrames runtime via postMessage. If the composition has GSAP timelines (window.__timelines) but no runtime, the player auto-injects it from CDN. An opaque player adds the runtime only to a composition from its own site that sets no security policy of its own; any other composition must load the runtime script itself, or the player fires error at the load limit, sealed or not. For a composition from another site, the message also says to include the runtime script in it. An error with no listener and no onerror is also written to the console as a [hyperframes-player] warning.
Distribution
| Format | File | Use case |
|---|---|---|
| ESM | hyperframes-player.js |
Bundlers (Vite, webpack, etc.) |
| CJS | hyperframes-player.cjs |
Node.js / require() |
| IIFE | hyperframes-player.global.js |
<script> tag, CDN |
All formats are minified with source maps. TypeScript definitions included.
License
MIT