Skip to main content
Video.js v10 is currently in beta. The API may change before the stable release.

React quickstart

Use @videojs/react to build players with composable React components and hooks.
1

Install the package

npm install @videojs/react
2

Create your player component

Create a new file for your player. Call createPlayer with a feature bundle to get a typed Player object that contains the Provider, Container, and a usePlayer hook scoped to that player instance.
components/player.tsx
'use client';

import '@videojs/react/video/skin.css';
import { createPlayer } from '@videojs/react';
import { Video, VideoSkin, videoFeatures } from '@videojs/react/video';

const Player = createPlayer({ features: videoFeatures });

interface MyPlayerProps {
  src: string;
}

export const MyPlayer = ({ src }: MyPlayerProps) => {
  return (
    <Player.Provider>
      <VideoSkin>
        <Video src={src} playsInline />
      </VideoSkin>
    </Player.Provider>
  );
};
The 'use client' directive is required for Next.js App Router. Omit it for Vite, Remix, or other setups that don’t use React Server Components.
3

Use the player in your app

Import and render your player component anywhere in your app:
app/page.tsx
import { MyPlayer } from '../components/player';

export default function Page() {
  return (
    <MyPlayer src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4" />
  );
}
4

Play an HLS stream (optional)

To stream with HLS, swap Video for HlsVideo from the media subpath. The feature bundle and skin stay the same:
components/player.tsx
'use client';

import '@videojs/react/video/skin.css';
import { createPlayer } from '@videojs/react';
import { VideoSkin, videoFeatures } from '@videojs/react/video';
import { HlsVideo } from '@videojs/react/media/hls-video';

const Player = createPlayer({ features: videoFeatures });

export const MyPlayer = ({ src }: { src: string }) => {
  return (
    <Player.Provider>
      <VideoSkin>
        <HlsVideo src={src} playsInline />
      </VideoSkin>
    </Player.Provider>
  );
};

Next steps

Architecture overview

Understand how state, UI, and media layers fit together.

React guide

Explore presets, skins, hooks, and advanced React patterns.

HTML guide

Explore presets, skins, custom elements, and HTML patterns.

Presets

Learn about the built-in /video, /audio, and /background presets.

Build docs developers (and LLMs) love