FrameworkStyle

Source

Media source state and actions for the player store

Tracks the current media source and readiness.

State

State Type Description
source string | null Current media source URL
canPlay boolean Whether enough data is loaded to begin playback

Actions

Action Description
loadSource(src) Load a new media source

Selector

Pass selectSource to PlayerController to subscribe to source state. Returns undefined if the source feature is not configured.

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

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

class SourceInfo extends MediaElement {
  readonly #source = new PlayerController(this, context, selectSource);
}

API Reference

Parameters

Parameter Type Default
state* object

Return Value

MediaSourceState | undefined