# Video.js v10 — React Guides (complete) > Every React guides page in one file (about 116k tokens). Index with descriptions: https://videojs.org/docs/framework/react/guides/llms.txt --- # React Installation Guide Install Video.js in React and build an accessible, customizable video player with composable controls Video.js is a **React video player component library**: composable primitives, hooks, and TypeScript types for building accessible, customizable players with minimal bundle sizes, advanced features, and consistency across browsers. > **Tip: Coming from another player?** > > Follow the migration guide for [Video.js 8](https://videojs.org/docs/framework/react/guides/migrate-from-video-js-8), [Mux Player](https://videojs.org/docs/framework/react/guides/migrate-from-mux-player), [Plyr](https://videojs.org/docs/framework/react/guides/migrate-from-plyr), [Media Chrome](https://videojs.org/docs/framework/react/guides/migrate-from-media-chrome), or [Vidstack](https://videojs.org/docs/framework/react/guides/migrate-from-vidstack). Each maps your existing setup onto Video.js v10 instead of starting from scratch. ## AI Quickstart Paste this prompt into your coding agent: ``` Install the Video.js skill: run `npx @videojs/cli agents skills` and follow the steps for the agent you are running in. If you can't run commands, follow the install instructions at https://github.com/videojs/skills instead. Then use the Video.js skill when you work on video or audio in this project. When installation details are needed, run `npx @videojs/cli agents init --framework react` to print the version-matched choices and instructions without changing files. ``` ## Installation options for coding agents The web Markdown page contains the default installation. Add the query parameters below to its `.md` URL for a complete, validated variation. From a project or an offline docs bundle, run the CLI command below instead. Both paths use the same installation renderer and only return instructions; they do not modify a project. This page fixes the installation method to `packaged` and the framework to `react`. ```sh npx @videojs/cli agents init ``` ### Query parameters - `project`: Whether to adapt the current project or scaffold a new one. New projects need a named app setup. Values: `new`, `existing`. Default: existing. - `preset`: The player configuration and control set. Values: `video`, `audio`, `live-video`, `live-audio`, `background-video`. Default: video. - `skin`: The visual skin. Neutral has cleaner surfaces and the same controls as Default. Values: `default`, `neutral`, `compat`, `none`. Default: default. Applies when preset is not background-video. - `media`: The media source or playback adapter. See the preset compatibility map below. Values: `background-video`, `hls-background-video`, `cloudflare`, `dash`, `hls`, `html5-audio`, `html5-video`, `mux-audio`, `mux-background-video`, `mux-video`, `spotify`, `tiktok`, `twitch`, `vimeo`, `youtube`. Default: the selected preset's first compatible media source. - `extensions`: A comma-separated list of optional player extensions compatible with the selected player. Pass `none` when no extension is needed. Values: `none`, `google-cast`, `mux-data`. Default: mux-data for Mux media; none otherwise (reported as defaulted). - `source-url`: The http:// or https:// media URL placed in the generated player example. Pass `demo` to choose the Video.js demo source for the selected media explicitly. Default: the Video.js demo source for the selected media (reported as defaulted). - `package-manager`: The command runner used for app setup, packages, Shadcn, and the development server. Values: `npm`, `pnpm`, `yarn`, `bun`. Default: pnpm. Applies when method is not cdn with template none. - `template`: The app setup and file layout. Values: `next`, `vite`, `start`, `react-router`, `astro`, `laravel`. Default: next. Run the command above without flags to see the corresponding CLI flags for every framework. ### Decide in this order 1. **Inspect the project.** Read package.json, framework config, and lockfiles to infer the framework, app setup, and package manager. React installs @videojs/react; HTML, Vue, and Svelte install @videojs/html. 2. **Choose the starting point.** Use existing when adapting a compatible project. Use new only when the user wants a new app or the intended workspace has no app. Confirm the choice when the workspace and request do not make it clear. 3. **Choose the player.** Use video unless the request signals another experience: audio, music, or podcasts use audio; a live stream uses live-video or live-audio; a muted, looping decorative video uses background-video. Ask only when those signals conflict. 4. **Choose the skin.** Use default unless the request asks for a minimal, cleaner, or more subtle look, which uses neutral; both contain the same controls. Use none only when the project builds its own controls. Ask only when those signals conflict. 5. **Choose the media.** Infer the adapter from the source when possible. Mux wins for Mux playback URLs: stream.mux.com/\.m3u8 or a bare playback ID uses mux-video, mux-audio, or mux-background-video rather than hls. Mux static renditions such as .mp4 or .m4a files use html5-video or html5-audio. Other .m3u8 URLs use hls. 6. **Choose extensions.** Mux Data is included by default for Mux video and audio sources. Add Google Cast when a standard or live video player with a ready-made skin should cast a compatible source. Use none when no extension is needed. 7. **Choose how to install.** This guide uses packaged modules, which need a bundler. Match the package manager to the project lockfile. For an existing HTML site without a build step, use CDN scripts instead. 8. **Return one explicit plan.** Confirm the choices once, then pass every applicable query parameter, including `extensions=none` when no extension is needed and `source-url=demo` when there is no media URL yet. Check that Defaulted options says none. Adapt conditional setup steps and existing paths before changing files. ### Compatible media sources by preset - `video`: `html5-video`, `hls`, `dash`, `mux-video`, `vimeo`, `youtube`, `cloudflare`, `tiktok`, `twitch` - `audio`: `html5-audio`, `mux-audio`, `spotify` - `live-video`: `hls`, `mux-video` - `live-audio`: `mux-audio` - `background-video`: `background-video`, `hls-background-video`, `mux-background-video` ### App setup by framework - `react`: templates `next`, `vite`, `start`, `react-router`, `astro`, `laravel` ### Installation pages - [Packaged modules: React](https://videojs.org/docs/guides/installation/react.md) - [Packaged modules: HTML](https://videojs.org/docs/guides/installation/html.md) - [Packaged modules: Vue](https://videojs.org/docs/guides/installation/vue.md) - [Packaged modules: Svelte](https://videojs.org/docs/guides/installation/svelte.md) - [Editable Shadcn source: React source](https://videojs.org/docs/guides/installation/shadcn.md?framework=react) - [Editable Shadcn source: HTML source](https://videojs.org/docs/guides/installation/shadcn.md?framework=html) - [CDN: HTML from jsDelivr](https://videojs.org/docs/guides/installation/cdn.md) If a preset and skin do not meet your user’s requirements, follow [Customize skins](https://videojs.org/docs/framework/react/guides/customize-skins#style-skin-source) to add the files for the closest skin to the project. As you develop with Video.js, rely heavily on [llms.txt](https://videojs.org/docs/framework/react/llms.txt) to make sure you always have the latest information. ## Selected options - `method`: `packaged` - `framework`: `react` - `project`: `existing` - `preset`: `video` - `skin`: `default` - `media`: `html5-video` - `extensions`: `none` - `source-url`: `https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4` - `package-manager`: `pnpm` - `template`: `next` Defaulted options: project, preset, skin, source-url, media, extensions, template, package-manager. ## Reproduce or change these instructions ```sh npx @videojs/cli agents init --method packaged --framework react --project existing --preset video --skin default --media html5-video --extensions none --source-url https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4 --package-manager pnpm --template next ``` ## Install the packages ```bash pnpm add @videojs/react@10.0.1 ``` ## Add your player Merge the example into the existing Next.js route or component that should render the player, and preserve unrelated content. ### `app/page.tsx` _Merge this into the existing file, or create the file when it is missing._ ```tsx import '@videojs/react/video/skin.css'; import { VideoPlayer, VideoSkin, Video } from '@videojs/react/video'; export default function Page() { return ( ); } ``` ## Run your app Start the development server and verify that the selected media plays. _Long-running: start it in the background, verify the result, then stop it._ ```bash pnpm dev ``` > These are instructions only. Review and run the commands in your project; no files were modified. That’s it! You now have a working Video.js player. ## Own the UI Packaged skins keep their controls and layout inside Video.js. When you need to add, remove, rearrange, or deeply restyle controls, use Shadcn to add the skin source to your project. Its components, layout, styles, and interactions become local files you can change. - [Install Video.js with Shadcn](https://videojs.org/docs/guides/installation/shadcn?framework=react#choose-how-to-install): Add editable skin source and build a working React or HTML player ## Choose what to do next ### Customize - [Customize skins](https://videojs.org/docs/framework/react/guides/customize-skins#style-a-packaged-skin): Change colors, typography, sizing, and poster presentation - [UI components](https://videojs.org/docs/framework/react/guides/architecture#ui-components): Explore the building blocks used by skins and custom controls - [Build your own component](https://videojs.org/docs/framework/react/guides/build-your-own-component): Connect custom UI to player state and actions ### Deploy - [Browser support](https://videojs.org/docs/framework/react/guides/browser-support): Check supported browsers and rendering environments - [TypeScript](https://videojs.org/docs/framework/react/guides/typescript): Configure TypeScript for Video.js packages - [Bundlers](https://videojs.org/docs/framework/react/guides/bundlers): Check bundler compatibility - [Content Security Policy](https://videojs.org/docs/framework/react/guides/content-security-policy): Configure Content Security Policy for your player Something not quite right? You can [submit an issue](https://github.com/videojs/v10/issues) and ask for help, or explore [other support options](https://videojs.org/html5-video-support). --- # Shadcn Installation Guide Add editable React or HTML skin source with the Shadcn registry Use Shadcn to add a Video.js skin's components, layout, styles, and interactions as React or HTML custom-element source. The CLI copies the files into your app so you can review and change them like any other source code. > **Tip: Coming from another player?** > > Follow the React migration guide for [Video.js 8](https://videojs.org/docs/framework/react/guides/migrate-from-video-js-8), [Mux Player](https://videojs.org/docs/framework/react/guides/migrate-from-mux-player), [Plyr](https://videojs.org/docs/framework/react/guides/migrate-from-plyr), [Media Chrome](https://videojs.org/docs/framework/react/guides/migrate-from-media-chrome), or [Vidstack](https://videojs.org/docs/framework/react/guides/migrate-from-vidstack). Each maps your existing setup onto Video.js v10 instead of starting from scratch. ## AI Quickstart Paste this prompt into your coding agent: ``` Install the Video.js skill: run `npx @videojs/cli agents skills` and follow the steps for the agent you are running in. If you can't run commands, follow the install instructions at https://github.com/videojs/skills instead. Then use the Video.js skill when you work on video or audio in this project. When installation details are needed, run `npx @videojs/cli agents init --method shadcn --framework react` for React, or `npx @videojs/cli agents init --method shadcn --framework html` for plain HTML. The command prints version-matched choices and instructions without changing files. ``` ## Installation options for coding agents The web Markdown page contains the default installation. Add the query parameters below to its `.md` URL for a complete, validated variation. From a project or an offline docs bundle, run the CLI command below instead. Both paths use the same installation renderer and only return instructions; they do not modify a project. This page fixes the installation method to `shadcn`. The `framework` query parameter selects React or HTML. ```sh npx @videojs/cli agents init ``` ### Query parameters - `framework`: The application framework that will host the player. React installs @videojs/react; HTML, Vue, and Svelte install @videojs/html. Values: `react`, `html`. Default: react. - `project`: Whether to adapt the current project or scaffold a new one. New projects need a named app setup. Values: `new`, `existing`. Default: existing. - `preset`: The player configuration and control set. Values: `video`, `audio`, `live-video`, `live-audio`. Default: video. - `skin`: The visual skin. Neutral has cleaner surfaces and the same controls as Default. Values: `default`, `neutral`, `compat`. Default: default. Applies when preset is not background-video. - `media`: The media source or playback adapter. See the preset compatibility map below. Values: `background-video`, `hls-background-video`, `cloudflare`, `dash`, `hls`, `html5-audio`, `html5-video`, `mux-audio`, `mux-background-video`, `mux-video`, `spotify`, `tiktok`, `twitch`, `vimeo`, `youtube`. Default: the selected preset's first compatible media source. - `extensions`: A comma-separated list of optional player extensions compatible with the selected player. Pass `none` when no extension is needed. Values: `none`, `google-cast`, `mux-data`. Default: mux-data for Mux media; none otherwise (reported as defaulted). - `source-url`: The http:// or https:// media URL placed in the generated player example. Pass `demo` to choose the Video.js demo source for the selected media explicitly. Default: the Video.js demo source for the selected media (reported as defaulted). - `package-manager`: The command runner used for app setup, packages, Shadcn, and the development server. Values: `npm`, `pnpm`, `yarn`, `bun`. Default: pnpm. Applies when method is not cdn with template none. - `template`: The app setup and file layout. Values: `next`, `vite`, `start`, `react-router`, `astro`, `laravel`. Default: next for React; vite otherwise. - `styling`: The Shadcn source styling. Compatible values depend on the framework. Values: `tailwind`, `css`. Default: tailwind for React; css otherwise. Applies when method=shadcn. Run the command above without flags to see the corresponding CLI flags for every framework. ### Decide in this order 1. **Inspect the project.** Read package.json, framework config, and lockfiles to infer the framework, app setup, and package manager. React installs @videojs/react; HTML, Vue, and Svelte install @videojs/html. 2. **Choose the starting point.** Use existing when adapting a compatible project. Use new only when the user wants a new app or the intended workspace has no app. Confirm the choice when the workspace and request do not make it clear. 3. **Choose the player.** Use video unless the request signals another experience: audio, music, or podcasts use audio; a live stream uses live-video or live-audio; a muted, looping decorative video uses background-video. Ask only when those signals conflict. 4. **Choose the skin.** Use default unless the request asks for a minimal, cleaner, or more subtle look, which uses neutral; both contain the same controls. Ask only when those signals conflict. 5. **Choose the media.** Infer the adapter from the source when possible. Mux wins for Mux playback URLs: stream.mux.com/\.m3u8 or a bare playback ID uses mux-video, mux-audio, or mux-background-video rather than hls. Mux static renditions such as .mp4 or .m4a files use html5-video or html5-audio. Other .m3u8 URLs use hls. 6. **Choose extensions.** Mux Data is included by default for Mux video and audio sources. Add Google Cast when a standard or live video player with a ready-made skin should cast a compatible source. Use none when no extension is needed. 7. **Choose how to install.** This guide uses Shadcn to copy editable skin source. React uses the React source catalog; plain HTML uses the HTML source catalog. Vue and Svelte use packaged modules. 8. **Choose the styling.** For React, use tailwind in a new app or an existing Tailwind app; otherwise use css. HTML source uses css. 9. **Return one explicit plan.** Confirm the choices once, then pass every applicable query parameter, including `extensions=none` when no extension is needed and `source-url=demo` when there is no media URL yet. Check that Defaulted options says none. Adapt conditional setup steps and existing paths before changing files. ### Compatible media sources by preset - `video`: `html5-video`, `hls`, `dash`, `mux-video`, `vimeo`, `youtube`, `cloudflare`, `tiktok`, `twitch` - `audio`: `html5-audio`, `mux-audio`, `spotify` - `live-video`: `hls`, `mux-video` - `live-audio`: `mux-audio` ### App setup and Shadcn styling by framework - `react`: templates `next`, `vite`, `start`, `react-router`, `astro`, `laravel`; styling `tailwind`, `css` - `html`: templates `vite`, `astro`, `laravel`; styling `css` ### Installation pages - [Packaged modules: React](https://videojs.org/docs/guides/installation/react.md) - [Packaged modules: HTML](https://videojs.org/docs/guides/installation/html.md) - [Packaged modules: Vue](https://videojs.org/docs/guides/installation/vue.md) - [Packaged modules: Svelte](https://videojs.org/docs/guides/installation/svelte.md) - [Editable Shadcn source: React source](https://videojs.org/docs/guides/installation/shadcn.md?framework=react) - [Editable Shadcn source: HTML source](https://videojs.org/docs/guides/installation/shadcn.md?framework=html) - [CDN: HTML from jsDelivr](https://videojs.org/docs/guides/installation/cdn.md) ## Selected options - `method`: `shadcn` - `framework`: `react` - `project`: `existing` - `preset`: `video` - `skin`: `default` - `media`: `html5-video` - `extensions`: `none` - `source-url`: `https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4` - `package-manager`: `pnpm` - `template`: `next` - `styling`: `tailwind` Defaulted options: project, preset, skin, source-url, media, extensions, template, package-manager, styling. ## Reproduce or change these instructions ```sh npx @videojs/cli agents init --method shadcn --framework react --project existing --preset video --skin default --media html5-video --extensions none --source-url https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4 --package-manager pnpm --template next --styling tailwind ``` ## Create components.json _Only when components.json is missing._ The registry steps below need components.json, so create it when the project has none. `shadcn init` also rewrites the theme tokens in the global stylesheet, such as app/globals.css or src/index.css; review that diff and restore any project tokens that should stay. ```bash pnpm dlx shadcn@latest init --base base --preset nova --yes ``` ## Add the Video.js Registry This adds the selected @videojs catalog when the namespace is missing. If components.json already defines @videojs with another URL, replace that value with the URL from this command first because Shadcn skips configured namespaces. ```bash pnpm dlx shadcn@latest registry add @videojs=https://shadcn.videojs.org/r/react/{name}.json ``` ## Add the skin source Make sure the working tree is clean or checkpointed so every added or replaced file is reviewable; ask before committing. The add command overwrites an existing Video.js skin so catalog and theme changes fully apply. Review and remove obsolete Video.js style files left by a previous catalog. ```bash pnpm dlx shadcn@latest add @videojs/video --overwrite --yes ``` ## Add your player Use the aliases.components value from components.json in the skin import when it differs from the generated @/components path. Merge the example into the existing Next.js route or component that should render the player, and preserve unrelated content. ### `app/page.tsx` _Merge this into the existing file, or create the file when it is missing._ ```tsx import { VideoPlayer, Video } from '@videojs/react/video'; import { VideoSkin } from '@/components/videojs/video/skin'; export default function Page() { return ( ); } ``` ## Run your app Start the development server and verify that the selected media plays. _Long-running: start it in the background, verify the result, then stop it._ ```bash pnpm dev ``` > These are instructions only. Review and run the commands in your project; no files were modified. Shadcn copies the current Video.js registry source, while package installs use the version shown above. That’s it! You now have a working Video.js player whose skin source lives in your project. ## Change the skin source ### React Start in `/videojs//skin.tsx`. Follow the [Customize skins](https://videojs.org/docs/framework/react/guides/customize-skins#style-skin-source) guide for the files that control layout, colors, controls, and interactions. ## Choose what to do next ### React #### Customize - [Customize skin source](https://videojs.org/docs/framework/react/guides/customize-skins#style-skin-source): Change the installed layout, controls, styles, and interactions - [UI components](https://videojs.org/docs/framework/react/guides/architecture#ui-components): Explore the building blocks used by skins and custom controls - [Build your own component](https://videojs.org/docs/framework/react/guides/build-your-own-component): Connect custom UI to player state and actions #### Deploy - [Browser support](https://videojs.org/docs/framework/react/guides/browser-support): Check supported browsers and rendering environments - [TypeScript](https://videojs.org/docs/framework/react/guides/typescript): Configure TypeScript for Video.js packages - [Bundlers](https://videojs.org/docs/framework/react/guides/bundlers): Check bundler compatibility - [Content Security Policy](https://videojs.org/docs/framework/react/guides/content-security-policy): Configure Content Security Policy for your player --- # Build your own UI component Create custom player controls that read state, dispatch actions, and stay accessible. Custom components subscribe to player state and dispatch actions, like built-in controls. ## You might not need a custom component Before building from scratch, check if an existing approach covers your use case: - **Change what a control renders**: use the `render` prop on any built-in component. See [UI components](https://videojs.org/docs/framework/react/guides/ui-components). - **Restyle a control**: use CSS custom properties and data attributes. See [UI components](https://videojs.org/docs/framework/react/guides/ui-components). - **Rearrange or remove controls**: add the skin source to your project, then modify it. See [Customize skins](https://videojs.org/docs/framework/react/guides/customize-skins#style-skin-source). Build a custom component when you need new behavior, a new state display, or integration with an external system. ## Place your component in the player Your component needs to be inside [``](https://videojs.org/docs/framework/react/reference/components/player) to access state. Place it inside [``](https://videojs.org/docs/framework/react/reference/components/player-container) if it should also participate in fullscreen and respond to user activity: ```tsx import { Container } from '@videojs/react'; ``` ## Full example A “skip intro” button that appears during the first 30 seconds of playback and seeks past the intro when clicked. **SkipIntroButton.tsx** ```tsx // The preset's usePlayer is typed for its feature bundle import { usePlayer } from '@videojs/react/video'; export function SkipIntroButton() { const store = usePlayer(); const currentTime = usePlayer((s) => s.currentTime); const paused = usePlayer((s) => s.paused); const visible = currentTime < 30 && !paused; return ( ); } ``` **SkipIntroButton.css** ```css .skip-intro-button { position: absolute; bottom: 5rem; right: 1rem; opacity: 0; pointer-events: none; transition: opacity 200ms; } .skip-intro-button[data-visible] { opacity: 1; pointer-events: auto; } ``` Your component needs to be inside a player, such as [``](https://videojs.org/docs/framework/react/reference/components/player), to access state. Place it inside [``](https://videojs.org/docs/framework/react/reference/components/player-container) if it should also participate in fullscreen and respond to user activity: ```tsx import { Container } from '@videojs/react'; import { Video, VideoPlayer, VideoSkin } from '@videojs/react/video'; import '@videojs/react/video/skin.css'; import { SkipIntroButton } from './SkipIntroButton'; export default function App() { return ( ); } ``` ## How it works Custom components read player state and dispatch actions through [features](https://videojs.org/docs/framework/react/guides/features). Each feature exposes a set. Here are some features you might reach for first: | State | Actions | Feature | | --- | --- | --- | | `paused`, `ended` | `play()`, `pause()` | [Playback](https://videojs.org/docs/framework/react/reference/api/feature-playback) | | `currentTime`, `duration` | `seek()` | [Time](https://videojs.org/docs/framework/react/reference/api/feature-time) | | `volume`, `muted` | `setVolume()`, `setMuted()` | [Volume](https://videojs.org/docs/framework/react/reference/api/feature-volume) | | `isFullscreen` | `requestFullscreen()`, `exitFullscreen()` | [Fullscreen](https://videojs.org/docs/framework/react/reference/api/feature-fullscreen) | The API reference lists every feature with the state and actions it adds. Access state and actions with the [`usePlayer`](https://videojs.org/docs/framework/react/reference/api/use-player) hook from your player’s preset. It knows which features that preset has, so state and actions are typed. (The standalone `usePlayer` export from `@videojs/react` returns an untyped store, so its values are `unknown` in TypeScript.) If you built the player with a custom feature set through [`createPlayer`](https://videojs.org/docs/framework/react/reference/api/create-player) — the escape hatch for custom feature sets — use the `usePlayer` it returns instead. ```tsx import { usePlayer } from '@videojs/react/video'; // Subscribe to state — re-renders only when selected values change const paused = usePlayer((s) => s.paused); const currentTime = usePlayer((s) => s.currentTime); // Get the store for dispatching actions (does not subscribe) const store = usePlayer(); await store.play(); store.setVolume(0.5); store.seek(30); ``` Custom controls also need real button semantics — the examples above set the accessible name and keyboard focus by hand. - [Learn more about accessibility in video players](https://videojs.org/docs/framework/react/guides/accessibility) ## Availability and constraints - Features are configured per player, so a feature your component asks for may not be present. Selectors return `undefined` for a missing feature; guard the value before using it, as the example does. - Volume, fullscreen, picture-in-picture, and remote playback also expose an `*Availability` property (`'available'`, `'unavailable'`, or `'unsupported'`) for hiding controls the platform does not support. See [Features](https://videojs.org/docs/framework/react/guides/features) for details. ## Common variations Before building from scratch, check if an existing approach covers your use case. Build a custom component when you need new behavior, a new state display, or integration with an external system. ### Change what a built-in control renders Use the `render` prop on any built-in component. See [UI components](https://videojs.org/docs/framework/react/guides/ui-components). ### Restyle a control Use CSS custom properties and data attributes. See [UI components](https://videojs.org/docs/framework/react/guides/ui-components). ### Rearrange or remove controls Add the skin source to your project and modify it. See [Customize skins](https://videojs.org/docs/framework/react/guides/customize-skins#style-skin-source). ## Troubleshooting ### State and actions are typed as `unknown` You’re using the standalone `usePlayer` export, which doesn’t know which features your player has. Import `usePlayer` from your player’s preset (for example `@videojs/react/video`), or use the hook returned by `createPlayer` if you built the player with a custom feature set. ### The component renders but never updates The component sits outside the player (such as ``), so `usePlayer` has no store to subscribe to. ## Related pages ### API - [usePlayer](https://videojs.org/docs/framework/react/reference/api/use-player): Hook to access the player store from within a Player - [createPlayer](https://videojs.org/docs/framework/react/reference/api/create-player): Factory function that creates a typed Player component and hooks - [Container](https://videojs.org/docs/framework/react/reference/components/player-container): The player's visual and interaction surface for layout, fullscreen, focus, and user activity. ### Guides - [Customize skins](https://videojs.org/docs/framework/react/guides/customize-skins): Style a packaged Video.js skin or add its source to change controls, layout, styles, and interactions --- # Architecture How Video.js players are structured — state, UI, media, and extensions Video.js v10 separates player responsibilities into parts that work independently or together, so you can use as much or as little of Video.js as you need. For the reasoning behind this design, see [Why Video.js?](https://videojs.org/docs/framework/react/guides/why-videojs). ## State management State is handled by a preset player component, which creates a central state store that all components can access. When you wrap your player in `VideoPlayer`, the components automatically connect to the state. ```tsx {/* All components inside automatically connect to state */} ``` You can access state and actions from anywhere within `VideoPlayer` with the [`usePlayer` hook](https://videojs.org/docs/framework/react/reference/api/use-player). - [Learn more about state and actions](https://videojs.org/docs/framework/react/guides/features) ## User interface Use a prebuilt **skin** or build your own from the individual **UI components**. ### Skins Skins are complete, pre-designed player UIs that package components and styles together. They give you a polished starting point, with a small set of CSS custom properties for common visual changes. They don’t try to cover every player with options. ```tsx ``` - [Learn more about skins](https://videojs.org/docs/framework/react/guides/skins) ### UI components If you want more control than a packaged skin offers, build your own UI from our components. Add, remove, and rearrange them to build the player you need. ```tsx ``` Skin source is a practical foundation for custom UI because it provides the same styled components as the packaged version. See [Customize skins](https://videojs.org/docs/framework/react/guides/customize-skins#style-skin-source) to add it to your project. - [Learn more about UI components](https://videojs.org/docs/framework/react/guides/ui-components) - [Build your own component](https://videojs.org/docs/framework/react/guides/build-your-own-component) ## Media Media components are the components that actually display your media. They’re essentially “players with no UI”. They handle the video/audio rendering and expose a consistent API. Media components can be format specific (HLS, DASH), service specific (YouTube, Vimeo, Mux), or use case specific (background video). ```tsx ``` - [Learn more about media](https://videojs.org/docs/framework/react/guides/media-sources) ## Extensions Extensions add behavior to a player without rendering UI or playing media themselves. ```tsx ``` An extension can provide behavior that a UI component controls: GoogleCast supplies the configurable Cast route, and [CastButton](https://videojs.org/docs/framework/react/reference/components/cast-button) renders the control that starts and ends a session. ## Presets **Presets** preconfigure the state, UI, and media for a specific use case. Extensions stay opt-in, so add them to a preset player when you need them. The default presets are `@videojs/react/video` and `@videojs/react/audio`, covering the baseline set of controls you’d expect from the HTML `