Player
The exports of react-video-kit/player.
Read Ready-made player to see how to use these.
Components
VideoPlayer
The complete player layout: every control, styled. Features come from plugins, and defaultPlugins() is a sensible set. Leaving it out keeps it out of the bundle.
| Prop | Type | Description |
|---|---|---|
| poster? | string | An image for the video element to show before playback starts. |
| media? | Omit<VideoHTMLAttributes<HTMLVideoElement>, "src" | "controls" | "poster"> | Props for the underlying video element. |
| tracks? | ReactNode | <track> elements for the video. |
| title? | ReactNode | The video's name, shown above the timeline with the controls. |
| eyebrow? | ReactNode | A short line above the title, such as a series or an episode. |
| description? | ReactNode | A sentence or two about the video, under the title while it's paused. |
| errorMessages? | Partial<Record<VideoErrorCode, ErrorMessage>> | Replaces the error overlay's text for particular error codes. |
| onError? | ((error: MediaErrorInfo) => void) | Called with every error, fatal or not, for logging. It can change between renders. |
| children? | ReactNode | Content rendered inside the player's root element. |
| src? | SourceInput | null | The video to play, which loads afresh when its value changes. |
| plugins? | readonly AnyPlugin[] | Set once. Define the array outside the component or memoize it. |
| load? | LoadStrategy | When the provider and its engine load. Set once. Defaults to eager. |
| player? | Player | Bring your own player instead of creating one. |
Functions
defaultPlugins
A sensible set for VideoPlayer: controls that hide, gestures, keys, and the usual menus.
() => AnyPlugin[]
Types
VideoPlayerProps
| Field | Type | Description |
|---|---|---|
| poster? | string | An image for the video element to show before playback starts. |
| media? | Omit<VideoHTMLAttributes<HTMLVideoElement>, "src" | "controls" | "poster"> | Props for the underlying video element. |
| tracks? | ReactNode | <track> elements for the video. |
| title? | ReactNode | The video's name, shown above the timeline with the controls. |
| eyebrow? | ReactNode | A short line above the title, such as a series or an episode. |
| description? | ReactNode | A sentence or two about the video, under the title while it's paused. |
| errorMessages? | Partial<Record<VideoErrorCode, ErrorMessage>> | Replaces the error overlay's text for particular error codes. |
| onError? | ((error: MediaErrorInfo) => void) | Called with every error, fatal or not, for logging. It can change between renders. |
| children? | ReactNode | Content rendered inside the player's root element. |
| src? | SourceInput | null | The video to play, which loads afresh when its value changes. |
| plugins? | readonly AnyPlugin[] | Set once. Define the array outside the component or memoize it. |
| load? | LoadStrategy | When the provider and its engine load. Set once. Defaults to eager. |
| player? | Player | Bring your own player instead of creating one. |