structyl

Video Player API

View component

The full prop reference for the Video Player component. A fully-featured HTML5 video player with playlists, chapter markers, SRT/VTT subtitles, video filters, quality levels, and HLS adaptive streaming.

Import

tsx
import { VideoPlayer } from '@structyl/styled';

Props

VideoPlayer

A feature-rich video player component supporting multiple video sources, playlists, subtitles, chapters, quality selection, filters, and keyboard controls. Supports MP4/WebM, YouTube URLs, and HLS streams.

PropTypeDefault
src#string

The video source URL (MP4, WebM, YouTube URL, or HLS .m3u8 stream)

poster#string | undefined

Poster/thumbnail image URL displayed before playback starts

autoPlay#boolean

Whether the video should start playing automatically

false
loop#boolean

Whether the video should loop when it reaches the end

false
muted#boolean

Whether the audio is muted by default

false
className#string

Custom CSS classes applied to the container div

''
subtitles#SubtitleTrack[]

Array of subtitle tracks to load ({ label, language, src, kind? })

[]
playlist#PlaylistItem[]

Array of playlist items for multi-video playback ({ id, title, src, poster?, duration? })

[]
chapters#Chapter[]

Array of chapter markers ({ id, title, startTime, endTime })

[]
onPlay#(() => void) | undefined

Callback fired when playback starts

onPause#(() => void) | undefined

Callback fired when playback pauses

onEnded#(() => void) | undefined

Callback fired when the video ends

onTimeUpdate#((currentTime: number) => void) | undefined

Callback fired on each time update, providing the current playback time in seconds

onVolumeChange#((volume: number) => void) | undefined

Callback fired when volume changes, providing the new volume (0-1)

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).

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library