structyl

Video Player

stable

A fully-featured HTML5 video player with playlists, chapter markers, SRT/VTT subtitles, video filters, quality levels, and HLS adaptive streaming.

Basic usage

0:00 / 0:00

Examples

With playlist

Pass an array of items to enable the built-in playlist panel with shuffle and repeat.

0:00 / 0:00

With chapters

Chapters are displayed as markers on the progress bar with tooltip titles.

0:00 / 0:00

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

bash
pnpm dlx structyl add video-player

API Reference

VideoPlayer

The root video player component.

PropTypeDefault
srcstring

URL of the video to play. Supports .mp4, .webm, and .m3u8 (HLS).

posterstring

Poster image URL shown before playback starts.

autoPlayboolean

Start playback automatically on mount.

false
loopboolean

Loop the video after it ends.

false
mutedboolean

Start with audio muted.

false
classNamestring

Additional class names for the root container.

subtitlesSubtitleTrack[]

Array of subtitle tracks to load. Each track has src, label, and language.

playlistPlaylistItem[]

Array of videos for the playlist panel.

chaptersChapter[]

Array of chapter markers shown on the progress bar.

onPlay() => void

Callback fired when playback starts.

onPause() => void

Callback fired when playback pauses.

onEnded() => void

Callback fired when the video ends.

onTimeUpdate(currentTime: number) => void

Fires continuously with the current playback time.

onVolumeChange(volume: number) => void

Fires when volume or mute state changes.

Keyboard interactions

KeyDescription
Space / KToggle play/pause.
Skip forward 10 seconds.
Skip backward 10 seconds.
Increase volume by 10%.
Decrease volume by 10%.
MToggle mute.
FToggle fullscreen.
PToggle Picture-in-Picture.
CToggle subtitles.
.Advance one frame (1/30 s).
,Go back one frame (1/30 s).
Video Player | structyl