API Reference
Events
The state-change event stream and what each type means.
VideoCard, VideoPlayer, and VideoStage all emit a single state-change event.
interface StateChangeEvent {
type:
| 'loaded'
| 'play'
| 'pause'
| 'ended'
| 'seeked'
| 'error'
| 'adstart'
| 'adend'
| 'volumechange'
| 'ratechange'
| 'captionchange'
| 'qualitychange'
| 'pipchange'
| 'loopchange'
| 'firstQuartile'
| 'midpoint'
| 'thirdQuartile'
| 'controlsopen'
| 'controlsclose'
| 'stageopen'
| 'stageclose'
| 'bufferstart'
| 'bufferend'
| 'timeupdate'
| 'tap'
currentTime: number
duration: number
src: string
error?: { code: number; message: string } | null
isMuted?: boolean // volumechange only
playbackRate?: number // ratechange only
captionIndex?: number | null // captionchange only; null = off
qualityHeight?: number | null // qualitychange only; the level's height in pixels, null = Auto
isPipActive?: boolean // pipchange only
isLooping?: boolean // loopchange only
element?: HTMLElement | null // controlsopen/controlsclose only
payload?: Record<string, unknown> // whatever you passed as the `payload` prop
}
Notes by type
| Type | Notes |
|---|---|
loaded | Once the duration is known, or the stream is detected as live; isLoaded flips true. Fires again after retry() |
firstQuartile / midpoint / thirdQuartile | Fire once each at 25%, 50%, 75% of duration - IAB-style progress analytics. Reset on loop restart |
bufferstart / bufferend | bufferstart once stalled longer than the spinner delay; bufferend on playing/canplay (or ended). For rebuffer count/ratio |
timeupdate | At most every 250ms during playback. Vue consumers get live currentTime/duration reactively from the ref - this exists for non-Vue consumers driving a custom seekbar |
tap | From the tap-to-reveal overlay, regardless of controls - the only signal a controls="false" consumer gets that the user tapped the video. Silent before playback starts, during an ad, under nativeUi, and with disableTapCapture |
captionchange / qualitychange | On every setCaptionTrack()/setQuality() call and on adapter-driven ABR switches, but never before playback starts |
loopchange / pipchange | On every toggle once playback has started - pipchange also when the user closes the browser's floating PiP window directly |
controlsopen / controlsclose | When the expanded controls popup mounts/unmounts, with element set to its root node. On close, element is a snapshot - it detaches immediately after |
stageopen / stageclose | VideoStage only, when it mounts its inner player (first video arrives) and tears it down |
volumechange, ratechange, loopchange, pipchange, captionchange and qualitychange all stay silent until playback has started, so a player configured through props emits nothing before its first play.