Views
VideoPlayer
Standard HLS video playback, synchronized to the shared clock.
Compatible dtypes: video
Purpose
Plays an MPEG-TS HLS stream via hls.js. Bypasses vuer-m3u's own Playlist engine because hls.js is a complete HLS implementation (demux, remux, MSE, ABR) — the two layers would only duplicate work. The clock is the only shared state.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | — | m3u8 playlist URL |
clock | TimelineClock | null | context | Falls back to <ClockProvider> |
className | string | — | Passed to the <video> element |
Data Schema
Standard HLS:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXTINF:9.967,
segment-001.ts
#EXTINF:10.000,
segment-002.ts
#EXT-X-ENDLISTConstraints:
- Segment codecs must be supported by MediaSource Extensions — H.264 + AAC is the safest baseline
- Omit
#EXT-X-ENDLISTfor live; hls.js handles live playlists natively - The playlist URL is fetched by hls.js, not by
Playlist, so custom decoders /fetchFnonPlaylistdo not apply here
Usage
Loading demo...
import {
useTimeline,
ClockProvider,
TimelineController,
VideoPlayer,
} from '@vuer-ai/vuer-m3u'
const VIDEO_URL = '/vuer-m3u-demo/video/playlist.m3u8'
export function VideoPlayerDemo() {
const { clock, state, play, pause, seek, setPlaybackRate, setLoop } = useTimeline()
return (
<ClockProvider clock={clock}>
<VideoPlayer src={VIDEO_URL} className="w-full aspect-video" />
<TimelineController
state={state}
onPlay={play}
onPause={pause}
onSeek={seek}
onSpeedChange={setPlaybackRate}
onLoopChange={setLoop}
/>
</ClockProvider>
)
}Clock sync
- Duration — the
<video>element'sdurationchangeevent callsclock.extendDuration(video.duration). - Playback —
clock.on('seek')routesplay/pause/seek/rateto the video element.