FrameworkStyle

Error

Media error state and actions for the player store

Tracks media errors.

API Reference

State

Property Type Details
error null | MediaError

Actions

Action Type Details
dismissError () => void

Selector

Pass selectError to usePlayer to subscribe to error state. Returns undefined if the error feature is not configured.

import { selectError, usePlayer } from '@videojs/react';

function ErrorDisplay() {
  const err = usePlayer(selectError);
  if (!err?.error) return null;

  return (
    <div>
      <p>{err.error.message}</p>
      <button onClick={err.dismissError}>Dismiss</button>
    </div>
  );
}