GuideGetting Started
Svelte Installation Guide
Install Video.js in Svelte or SvelteKit and build a video player with HTML custom elements
Svelte and SvelteKit apps use Video.js HTML custom elements directly in their markup. These lightweight, framework-free components build accessible, customizable players with small bundles, advanced features, and consistent behavior across browsers.
AI Quickstart
Paste this prompt into your coding agent:
Install the Video.js skill using one method. In Codex, run `codex plugin marketplace add videojs/skills`, then `codex plugin add videojs@videojs`, and start a new session. In Claude Code, run `claude plugin marketplace add videojs/skills`, then `claude plugin install videojs@videojs`, and start a new session or run `/reload-plugins`. In VS Code or Cursor, install `https://github.com/videojs/skills` as a plugin from source. For another agent, run `npx skills add https://github.com/videojs/skills --skill videojs` and select the agent. Then use the Video.js skill when working on this project.Choose your JS framework
Your framework determines which installation methods are available below.
- React: Components and hooks for React 19. Available methods: Packaged, Shadcn.
- HTML: Custom elements for any stack. Available methods: Packaged, Shadcn, CDN.
- Vue: Vue 3 and Nuxt using the HTML custom elements. Available methods: Packaged, Shadcn.
- Svelte: Svelte 5 and SvelteKit using the HTML custom elements. Available methods: Packaged, Shadcn.
Choose your use case
- Video (
video): On-demand video with full controls. - Audio (
audio): Podcasts, music, and audio-only playback. - Live Video (
live-video): Streams with a Live button, no duration. - Live Audio (
live-audio): Live radio and audio streams. - Background Video (
background-video): Muted, looping video behind your content.
The live presets suit streams: they drop the duration and current-time displays that on-demand playback relies on, and they offer only media that exposes live-edge state.
Choose your skin
- Default (
default): the complete control set with a modern, frosted look. Reference pages:<video-skin>,<audio-skin>,<live-video-skin>, and<live-audio-skin>. - Minimal (
minimal): the same control set with clean, solid surfaces. Reference pages:<video-minimal-skin>,<audio-minimal-skin>,<live-video-minimal-skin>, and<live-audio-minimal-skin>. - No skin (
none): player and media behavior without a packaged UI.
Background Video always uses <background-video-skin>, whatever skin you choose.
Choose your media source
Available media sources depend on the use case:
| Media source | Use cases | HTML element | Adapter package |
|---|---|---|---|
HTML5 Video (html5-video) | Video | <video> | None |
HLS (hls) | Video, Live Video | <hlsjs-video> | @videojs/hlsjs-video |
DASH (dash) | Video | <dash-video> | @videojs/dash-video |
Mux (mux-video) | Video, Live Video | <mux-video> | @videojs/mux-video |
Vimeo (vimeo) | Video | <vimeo-video> | @videojs/vimeo-video |
YouTube (youtube) | Video | <youtube-video> | @videojs/youtube-video |
Cloudflare Stream (cloudflare) | Video | <cloudflare-video> | @videojs/cloudflare-video |
TikTok (tiktok) | Video | <tiktok-video> | @videojs/tiktok-video |
Twitch (twitch) | Video | <twitch-video> | @videojs/twitch-video |
HTML5 Audio (html5-audio) | Audio | <audio> | None |
Mux (mux-audio) | Audio, Live Audio | <mux-audio> | @videojs/mux-audio |
Spotify (spotify) | Audio | <spotify-audio> | @videojs/spotify-audio |
Background Video (background-video) | Background Video | <background-video> | None |
HLS uses <hlsjs-video> for broad compatibility. To reduce your bundle size, try our lightweight HLS engine, <hls-video>.
The keys in parentheses are the values the docs CLI (npx @videojs/cli docs guides/installation/svelte) accepts for its --preset, --skin, and --media flags. Run noninteractively, it also needs --source-url (pass '' for demo media) and --package-manager (npm, pnpm, yarn, or bun).
Choose how to install
Pick one starting path. These are alternatives, not steps to run in sequence. Shadcn does not provide source for background video or a no-skin player. CDN availability also depends on the selected media source.
- Packaged: Install packages and use a ready-made skin.
- Shadcn: Add editable HTML custom-element skin source to your project.
The code below is a complete example for the default Video, Default skin, and HTML5 Video choices with demo media. For another combination, swap in the imports and markup from the preset, skin, and media reference pages linked above, and replace the demo URL with your own.
Choose your JS framework
Choose the JavaScript framework for your project.
Choose your use case
Choose the ready-made player that is closest to what you are building.
Choose your skin
Choose how your player looks. You can add the files for any skin to your project and edit them later.
Choose your media source
Paste a media URL to detect its source type, pick one directly, or upload a video to Mux. The generated packages and component update with your choice.
Optional. The URL also ends up in your generated code.
Choose how to install
Choose from the installation options available for your selections. Shadcn adds editable HTML custom-element source to your Svelte project.
Install the packages
Install the HTML elements and any playback adapter your selected media source needs.
Add your player
Add a component that imports the elements it renders. Svelte passes hyphenated tags through to the browser, so no compiler configuration is needed. The imports register the selected player, skin, media, and extensions; the markup composes them.
Then render the component in a page and pass it the media source you selected above.
That’s it! You now have a working Video.js player.
Own the UI
Packaged skins keep their controls and layout inside Video.js. When you need to add, remove, rearrange, or deeply restyle controls, use Shadcn to add the skin source to your project. Its components, layout, styles, and interactions become local files you can change.
Choose what to do next
Customize
Deploy
Something not quite right? You can submit an issue and ask for help, or explore other support options.
