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 usePlayer to subscribe to source state. Returns undefined if the source feature is not configured.
import { selectSource, usePlayer } from '@videojs/react';
function SourceInfo() {
const source = usePlayer(selectSource);
if (!source) return null;
return <span>{source.src}</span>;
}API Reference
Parameters
| Parameter | Type | Default | Details |
|---|---|---|---|
state* | object | — |
Return Value
MediaSourceState | undefined