<hyperframes-player> custom element that embeds a HyperFrames composition anywhere — in any framework or plain HTML. Zero dependencies, 3KB gzipped.
When to Use
Use@hyperframes/player when you need to:
- Embed a rendered composition in a website, dashboard, or app
- Add a video-like player to a landing page or product demo
- Show compositions in documentation or blog posts
- Edit compositions interactively — use the studio
- Preview during development — use the CLI (
npx hyperframes preview) - Render to MP4 — use the CLI or producer
Quick Start
Via CDN
Via npm
HTML Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
src | string | required | URL or relative path to composition HTML |
width | number | 1920 | Composition width in pixels |
height | number | 1080 | Composition height in pixels |
controls | boolean | false | Show playback controls overlay |
autoplay | boolean | false | Start playing on load |
loop | boolean | false | Loop playback |
muted | boolean | true | Mute audio (required for autoplay in most browsers) |
poster | string | — | Image URL to show before first play |
playback-rate | number | 1 | Playback speed multiplier |
JavaScript API
The player mirrors the native<video> element API:
Events
| Event | Detail | Description |
|---|---|---|
ready | { duration } | Composition loaded and timeline discovered |
timeupdate | { currentTime } | Fires during playback (~30fps) |
play | — | Playback started |
pause | — | Playback paused |
ended | — | Playback reached end |
error | { message } | Load or runtime error |
Framework Examples
React
Vue
Programmatic
Architecture
The player uses an iframe inside a Shadow DOM container. This provides:- Isolation — composition CSS/JS can’t leak into or conflict with your page
- Security — iframe sandbox restricts composition capabilities
- Scaling — auto-scales the composition to fit the player’s container via CSS transforms
postMessage). Existing compositions work without modification.
Controls
When thecontrols attribute is present, a minimal overlay appears at the bottom:
- Play/Pause button (left)
- Scrub bar with drag support (mouse + touch)
- Time display showing current / total duration (right)
- Auto-hides after 3 seconds of inactivity, reappears on hover