createPlayer is the entry point for setting up a Video.js player in React. Pass a features array and receive a set of React components and hooks that are fully typed to those features.
Overloads
- Video
- Audio
- Custom features
Parameters
Configuration object for the player.
Return value
Returns aCreatePlayerResult object containing components and hooks typed to the features you passed.
React component that creates a player store and makes it available to all descendants via context. Every player needs exactly one
Provider. It renders no visible element — it is a pure state boundary.The player root element. Wraps your media element and controls. Attaches the store to the DOM subtree when a media element is registered, enabling fullscreen and other container-scoped features.Accepts all standard
HTMLDivElement attributes via ContainerProps extends HTMLAttributes<HTMLDivElement>.Typed hook for accessing the player store. See usePlayer for full documentation.Without a selector, returns the store instance (no subscription). With a selector, subscribes to derived state and re-renders on changes.
Hook that returns the current
HTMLMediaElement registered with the player, or null if no media element has mounted yet. See useMedia for full documentation.Basic usage
Extended layout
TheProvider scope can extend beyond the fullscreen target. Components outside Container still have full store access but won’t enter fullscreen with the video.
TypeScript types
| Type | Description |
|---|---|
CreatePlayerConfig<Features> | Input config accepted by createPlayer. |
CreatePlayerResult<Store> | The object returned by createPlayer. |
ProviderProps | Props accepted by the Provider component. |
UsePlayerHook<Store> | The typed usePlayer hook signature. |