ReferencePlayer
PlayerController
Reactive controller for accessing player store state in HTML custom elements
Import
PlayerController is a reactive controller that consumes the player store from playerContext. Without a selector it returns the store instance directly (no subscription — use this for actions). With a selector it returns the selected value and subscribes to changes, triggering a host update on shallow-equal change. Access the current value via .value, which returns undefined until connected to a player.
The controller exported by each preset, or returned by createPlayer, is already bound to that player’s context, so pass only the host and optional selector. The lower-level PlayerController exported from @videojs/html accepts the context as its second argument; its constructor signatures are documented below.