Skip to content
FrameworkStyle

Playback

Play/pause state and actions for the player store

Controls play/pause state and tracks whether playback has started or is stalled.

API Reference

State

PropertyTypeDetails
pausedboolean
endedboolean
startedboolean
waitingboolean

Actions

ActionTypeDetails
play() => Promise<void>
pause() => void
togglePaused() => boolean

Selector

Pass selectPlayback to PlayerController to subscribe to playback state. Returns undefined if the playback feature is not configured.

import { createPlayer, MediaElement, selectPlayback } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';

const { PlayerController, context } = createPlayer({ features: videoFeatures });

class PlayButton extends MediaElement {
  readonly #playback = new PlayerController(this, context, selectPlayback);
}