FrameworkStyle

selectSource

Select the source state slice from the player store

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

The returned state includes the current src and type.

import { usePlayer } from '@videojs/react';
import { selectSource } from '@videojs/core/dom';

function SourceInfo() {
  const source = usePlayer(selectSource);
  if (!source) return null;

  return <span>{source.src}</span>;
}

API Reference

Parameters

Parameter Type Default
state* object

Return Value

MediaSourceState | undefined

VideoJS