Skip to content

ReferenceFeatures

Playback

Play/pause state and actions for the player store

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

Import

import { playbackFeature } from '@videojs/html';

The audioFeatures, liveAudioFeatures, liveVideoFeatures, and videoFeatures feature bundles include this feature.

API Reference

State

PropertyTypeDetails
pausedboolean
endedboolean
startedboolean
waitingboolean

Actions

ActionTypeDetails
playfunction
pausefunction
togglePausedfunction

Selector

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

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

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

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