Video Player
stableA fully-featured HTML5 video player with playlists, chapter markers, SRT/VTT subtitles, video filters, quality levels, and HLS adaptive streaming.
Basic usage
Examples
With playlist
Pass an array of items to enable the built-in playlist panel with shuffle and repeat.
With chapters
Chapters are displayed as markers on the progress bar with tooltip titles.
YouTube video
Pass any YouTube URL — the player automatically detects it and renders a native YouTube embed.
Features
- HLS adaptive streaming via hls.js — automatic quality switching.
- Playlist with shuffle and repeat modes.
- Chapter markers with tooltip labels and progress-bar marks.
- SRT and VTT subtitle support with font, color, and position controls.
- Video filter sliders: brightness, contrast, saturation, hue, blur, and sepia.
- Quality level selection for HLS streams.
- Thumbnail preview on progress-bar hover.
- Picture-in-Picture and Fullscreen APIs.
- Full keyboard shortcut set (Space, ←/→, ↑/↓, M, F, P, C).
- Consumes @structyl/themes CSS tokens — respects your theme automatically.
Installation
pnpm dlx structyl add video-playerAPI Reference
VideoPlayer
The root video player component.
| Prop | Type | Default |
|---|---|---|
| src | stringURL of the video to play. Supports .mp4, .webm, and .m3u8 (HLS). | — |
| poster | stringPoster image URL shown before playback starts. | — |
| autoPlay | booleanStart playback automatically on mount. | false |
| loop | booleanLoop the video after it ends. | false |
| muted | booleanStart with audio muted. | false |
| className | stringAdditional class names for the root container. | — |
| subtitles | SubtitleTrack[]Array of subtitle tracks to load. Each track has src, label, and language. | — |
| playlist | PlaylistItem[]Array of videos for the playlist panel. | — |
| chapters | Chapter[]Array of chapter markers shown on the progress bar. | — |
| onPlay | () => voidCallback fired when playback starts. | — |
| onPause | () => voidCallback fired when playback pauses. | — |
| onEnded | () => voidCallback fired when the video ends. | — |
| onTimeUpdate | (currentTime: number) => voidFires continuously with the current playback time. | — |
| onVolumeChange | (volume: number) => voidFires when volume or mute state changes. | — |
Keyboard interactions
| Key | Description |
|---|---|
| Space / K | Toggle play/pause. |
| → | Skip forward 10 seconds. |
| ← | Skip backward 10 seconds. |
| ↑ | Increase volume by 10%. |
| ↓ | Decrease volume by 10%. |
| M | Toggle mute. |
| F | Toggle fullscreen. |
| P | Toggle Picture-in-Picture. |
| C | Toggle subtitles. |
| . | Advance one frame (1/30 s). |
| , | Go back one frame (1/30 s). |