0.0.2

Video Controller

Control playback with play, pause, stop, seek, mute, unmute, setVolume, and reactive state properties.

The video controller lives at instance.api.controller and combines imperative playback methods (play, pause, seek, volume) with reactive state properties that update automatically during playback.

const controller = instance.api.controller;

Methods

MethodSignatureDescription
play() => Promise<void>Start or resume playback
pause() => voidPause playback
stop() => voidStop playback and reset to the beginning
seek(value: number) => voidSeek to a specific time in seconds
setVolume(value: number) => voidSet volume level (0--1)
mute() => voidMute the video
unmute() => voidUnmute the video
toggleMute() => voidToggle between muted and unmuted

Usage

// Start playback
await controller.play();

// Seek to 30 seconds
controller.seek(30);

// Set volume to 50%
controller.setVolume(0.5);

// Stop and reset
controller.stop();

Reactive state

The controller also exposes reactive state properties from ScenaVideoData. These update automatically during playback.

PropertyTypeDescription
stateScenaVideoStateCurrent playback state
currentTimenumberCurrent playback position in seconds
durationnumberTotal video duration in seconds
progressnumberPlayback progress as a fraction (0--1)
volumenumberCurrent volume level (0--1)
buffernumberBuffered amount as a fraction (0--1)
bufferedTimeRanges | nullRaw TimeRanges from the video element
isBufferingbooleanWhether the video is currently buffering
isSeekingbooleanWhether a seek operation is in progress
isMutedbooleanWhether the video is muted
console.log(controller.currentTime); 
console.log(controller.duration);    
console.log(controller.progress);
console.log(controller.state);
See Video State for the full list of playback states.