Beta —
@videojs/html is close to stable. Experimental adoption in real projects is welcome.@videojs/html is a comprehensive library for building media players with vanilla JavaScript and Web Components. It provides a complete set of Custom Elements, state management, controllers, and utilities for creating feature-rich, accessible video and audio players — no framework required.
Installation
CDN
For quick embedding without a build step, load the video preset directly from a CDN:Quick start
Exports
| Entry point | Description |
|---|---|
. | Core APIs — createPlayer, PlayerController, and related utilities |
./video | Video preset — registers video-player, video-skin, and hls-video elements |
./audio | Audio preset — registers audio player elements |
./background | Background preset — registers background player elements |
./ui/* | Individual UI custom element definitions |
./feature/* | Individual feature module definitions |
./media/* | Individual media custom element definitions |
Presets
Presets are the fastest way to get a working player. Each preset imports and defines a curated set of custom elements in one line:Individual elements
For fine-grained tree-shaking, import individual element definitions:Custom elements
Player structure
| Element | Description |
|---|---|
video-player | Root player container, manages state and lifecycle |
video-skin | Default skin layout, assembles controls into a complete UI |
hls-video | <video> element with HLS and DASH playback support |
Controls
| Element | Description |
|---|---|
media-play-button | Play/pause toggle |
media-mute-button | Mute/unmute toggle |
media-fullscreen-button | Fullscreen toggle |
media-pip-button | Picture-in-picture toggle |
media-seek-button | Seek forward/backward by a fixed interval |
media-captions-button | Captions/subtitles toggle |
media-playback-rate-button | Playback speed selector |
media-time-slider | Scrubber/seek bar |
media-volume-slider | Volume control slider |
media-time-display | Current time / duration display |
media-thumbnail | Preview thumbnail |
media-buffering-indicator | Loading/buffering state indicator |
media-poster | Video poster image |
media-controls | Layout container for grouping controls |
media-tooltip | Accessible tooltip |
media-popover | Accessible popover |
Programmatic API
Dependencies
| Package | Role |
|---|---|
@videojs/core | Core player logic and feature definitions |
@videojs/element | Custom element base classes and mixins |
@videojs/store | Reactive state management |
@videojs/spf | Stream Processing Framework |
@videojs/utils | Shared utility functions |
Related packages
@videojs/react
React components alternative using the same core.
@videojs/core
Runtime-agnostic core used by this package.
@videojs/store
Reactive state management used by custom elements.
@videojs/spf
Stream Processing Framework for HLS and DASH.