FrameworkStyle

selectFullscreen

Select the fullscreen state slice from the player store

Pass selectFullscreen to usePlayer to subscribe to fullscreen state. Returns undefined if the fullscreen feature is not configured.

The returned state includes whether fullscreen is active and its availability on the current platform.

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

function FullscreenButton() {
  const fs = usePlayer(selectFullscreen);
  if (!fs || fs.availability !== 'available') return null;

  return (
    <button onClick={fs.toggle}>
      {fs.active ? 'Exit fullscreen' : 'Fullscreen'}
    </button>
  );
}

API Reference

Parameters

Parameter Type Default
state* object

Return Value

MediaFullscreenState | undefined

VideoJS