Skip to content
FrameworkStyle

Cast

Cast state and actions for the player store

Controls casting to remote playback devices (e.g. Chromecast). Exits fullscreen before initiating a cast session.

API Reference

State

Property Type Details
castState 'disconnected' | 'connecting' | 'connected'
castAvailability 'available' | 'unavailable' | 'unsupported'

Actions

Action Type Details
toggleCast () => Promise<void>

Selector

Pass selectCast to PlayerController to subscribe to cast state. Returns undefined if the cast feature is not configured.

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

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

class CastButton extends MediaElement {
  readonly #cast = new PlayerController(this, context, selectCast);
}