Skip to content
FrameworkStyle

Overview

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?.

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.

{/* All components inside automatically connect to state */}
<VideoPlayer>
  <VideoSkin>
    <Video src="video.mp4" />
  </VideoSkin>
</VideoPlayer>

You can access state and actions from anywhere within VideoPlayer with the usePlayer hook.

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.

<VideoPlayer>
  <VideoSkin>
    <Video src="video.mp4" />
  </VideoSkin>
</VideoPlayer>

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.

<VideoPlayer>
  <Container>
    <Video src="video.mp4" />
    <Controls.Root>
      <Controls.Content>
        <PlayButton />
        {/* ... */}
      </Controls.Content>
    </Controls.Root>
  </Container>
</VideoPlayer>

The easiest way to get started is to eject the closest skin and use its styled components as a foundation.

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).

<VideoPlayer>
  <VideoSkin>
    <HlsJsVideo src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM.m3u8" />
  </VideoSkin>
</VideoPlayer>

Extensions

Extensions add behavior to a player without rendering UI or playing media themselves.

<VideoPlayer>
  <VideoSkin>
    <MuxVideo source={{ playbackId: 'PLAYBACK_ID' }} />
    <MuxData />
    <GoogleCast />
  </VideoSkin>
</VideoPlayer>

An extension can provide behavior that a UI component controls: GoogleCast supplies the configurable Cast route, and CastButton 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 <video> and <audio> tags.

Beyond the defaults, presets target more specific use cases. The /background preset combines a media element with autoplay, mute, and loop built in, a skin with no controls, and only the features needed to power it.

You can use it from @videojs/react/background.