Skip to content
Dice UI

December 2026 - Media Player on Video.js

The media player is rebuilt on Video.js v10 and gains YouTube, Vimeo, HLS, DASH, Shaka and DRM support behind the same parts. Includes breaking changes.

Media Player now runs on Video.js v10 instead of Media Chrome. The parts keep their names and their shadcn look, and the component is about 62% shorter in both bases: 1,276 lines instead of 3,353 in Radix, and 1,281 instead of 3,390 in Base UI.

What moved to Video.js

  • Player state. MediaPlayer is a Video.js player. useMediaPlayer is its typed store hook: read state with a selector, such as useMediaPlayer((state) => state.paused), and call actions on the store, such as player.play().
  • Controls. Play, seek, volume, time, fullscreen, picture in picture and captions render Video.js's headless controls through diceui's Button and slider styles. Their labels follow the state and are translated through Video.js's i18n.
  • Keyboard shortcuts and gestures. Shortcuts work while focus is anywhere inside the player, and every control exposes its shortcut with aria-keyshortcuts. Tap toggles playback, double-tap on either side seeks 10 seconds, and double-tap in the center toggles fullscreen.
  • Announcements. A polite live region reads out keyboard actions, such as "Seeked to 5 seconds" or "Captions off".
  • Menus. The settings menu's quality and captions options come from the media and hide when it has none. Quality shows the level the engine picked, such as "Auto (720p)".
  • Tooltips. MediaPlayerTooltip uses Video.js's tooltip, which reads the label and shortcut from its trigger and needs no portal container. The install step that patched shadcn Tooltip and DropdownMenu is gone.

Sources

Pass any Video.js media component to MediaPlayerVideo, with asChild in Radix or render in Base UI, and install its package next to @videojs/react.

  • HLS with HlsJsVideo from @videojs/hlsjs-video, or the browser's own HLS with NativeHlsVideo.
  • DASH with DashVideo, or with Shaka Player through ShakaVideo from @videojs/shaka-video.
  • DRM. ShakaVideo and HlsJsVideo take license servers in source.drm, keyed by key system. Widevine plays in Chrome, Edge and Firefox; FairPlay needs Safari and your own certificate.
  • YouTube and Vimeo with YouTubeVideo and VimeoVideo, behind the same controls.

Video.js marks these media components as unstable, so their options may change in a minor release.

HLS quality starts at 720p

MediaPlayerVideo caps automatic HLS quality at 720p by default. Without the cap, hls.js loaded a 1920×800 first segment into a 900 px player; with it, the first frame on Chrome's Fast 4G preset arrives in 1.8 s instead of 2.9 s. Pass maxAutoResolution="1080p" to raise the cap, or maxAutoResolution={null} to lift it. Viewers can still pick a higher quality from the settings menu.

Size and performance

  • Bundle. The default example grows from 68.7 to 100.3 KB gzipped in Radix (+31.6 KB), and from 103.6 to 128.6 KB in Base UI (+25.0 KB). Video.js's core replaces Media Chrome's smaller store. Engines like hls.js, Shaka, YouTube and Vimeo load only where you import them.
  • Playback. The player re-renders about five times a second while a video plays, and spends about the same main-thread time as before.
  • Time remaining lags slightly on long videos. To keep playback cheap, the player updates time on the media's timeupdate events and skips updates that wouldn't change the display. On videos longer than about four minutes, MediaPlayerTime variant="remaining" can trail the elapsed time by up to a second.

Breaking changes

  • Renamed props. Boolean props that show something now use a positive show name:

    PartBeforeAfterDefault
    MediaPlayerwithoutTooltipshowTooltiptrue
    MediaPlayerSeekwithTimeshowTimefalse
    MediaPlayerSeekwithoutChaptershowChaptertrue
    MediaPlayerSeekwithoutTooltipshowTooltiptrue
  • Removed root callbacks. onPlay, onPause, onEnded, onTimeUpdate, onVolumeChange, onMuted, onMediaError, onPipError and onFullscreenChange are gone from MediaPlayer. Put media events on MediaPlayerVideo or MediaPlayerAudio, or read the state with useMediaPlayer.

  • Removed root composition. MediaPlayer no longer takes asChild or render.

  • Removed parts and hooks. MediaPlayerPortal and useMediaPlayerStore are gone. useMediaPlayer is now Video.js's store hook, so its state names change, such as mediaPaused to paused.

  • speeds moved to the root. Set it on MediaPlayer instead of MediaPlayerPlaybackSpeed or MediaPlayerSettings.

  • Seek preview props. MediaPlayerSeek drops tooltipThumbnailSrc, tooltipTimeVariant and the tooltipCollision* props. Thumbnails come from a metadata text track labeled thumbnails, and chapter titles from a chapters track.

  • Error UI. MediaPlayerError is an alert dialog with one dismiss button. Its error, onRetry and onReload props and its retry and reload buttons are gone.

  • Data attributes. data-state is replaced by data-paused, data-muted, data-fullscreen, data-pip, data-active and data-visible.

  • Audio shortcuts. Arrow keys seek and change volume without Shift.

  • Removed demo files. The docs site no longer ships /assets/cloud.mp4 and /assets/lofi.mp3. Point any copy of the old examples at your own media.

tooltipDelayDuration (Radix), tooltipDelay (Base UI), tooltipSideOffset, autoHide, disabled and expandable are unchanged.

Examples

The docs examples play openly licensed films with a credit under each player: Sintel, Big Buck Bunny and Elephants Dream from the Blender Foundation, through Blender's mirror, Mux's samples and test streams, YouTube and Vimeo. New examples show a custom skin and Widevine DRM through Shaka.

Migrating

Reinstall the component, then install the package for each media component you use, such as @videojs/hlsjs-video for HlsJsVideo:

pnpm dlx shadcn@latest add "@diceui/media-player"

Then rename the boolean props and move media events to the media part:

<MediaPlayer
  withoutTooltip
  showTooltip={false} 
  onEnded={onEnded} 
>
  <MediaPlayerVideo src="/video.mp4" /> {}
  <MediaPlayerVideo src="/video.mp4" onEnded={onEnded} /> {}
  <MediaPlayerControls>
    <MediaPlayerSeek withTime withoutChapter /> {}
    <MediaPlayerSeek showTime showChapter={false} /> {}
  </MediaPlayerControls>
</MediaPlayer>

useMediaPlayer now reads Video.js state, whose names drop the media prefix, and it also covers what useMediaPlayerStore held:

const isPaused = useMediaPlayer((state) => state.mediaPaused); 
const isPaused = useMediaPlayer((state) => state.paused); 
const isVisible = useMediaPlayerStore((state) => state.controlsVisible); 
const isVisible = useMediaPlayer((state) => state.controlsVisible); 

On this page