Pro (paid add-on)
Video and audio players
ProVideoPlayer and AudioPlayer put brand-styled controls on the browser's own <video> and <audio>, so playback, formats and captions stay native, with a full set of keyboard shortcuts.
Part of Pro
This page documents part of @vjdesigns-pro/ui, the paid add-on package. Using it needs a Pro license and @vjdesigns/vjdesigns-ui 3.8.0 or later. Like the free package, it works in both modes, every brand, all 32 languages and right to left. Install it as described in Account forms.
Video
List several sources and the browser plays the first format it supports. tracks adds WebVTT captions, chosen from a captions menu; prerecorded video with speech needs them (WCAG 1.2.2). Size it with width, height or aspectRatio, plus fit and bordered. The controls offer play, seek, time, volume, captions, speed, picture in picture and full screen, and fade while playing.
import { AudioPlayer, VideoPlayer } from "@vjdesigns-pro/ui";
<VideoPlayer
title="Defensive footwork drills"
poster="/media/footwork.jpg"
aspectRatio="16 / 9"
sources={[
{ src: "/media/footwork.webm", type: "video/webm" },
{ src: "/media/footwork.mp4", type: "video/mp4" },
]}
tracks={[{ src: "/media/footwork.en.vtt", srcLang: "en", label: "English", default: true }]}
/>
Audio
AudioPlayer has the same controls for audio (without captions or full screen), with an optional title, artist and cover artwork.
<AudioPlayer
title="Episode 12: Building a youth program"
artist="Courtside podcast"
artwork={<img src="/media/podcast.jpg" alt="" />}
sources={[{ src: "/media/episode-12.mp3", type: "audio/mpeg" }]}
/>
Keyboard
- Space or K: play and pause.
- Left and Right arrows: back or forward 5 seconds, following the reading direction. J and L: 10 seconds.
- Up and Down arrows: volume. M: mute.
- C: captions. F: full screen. < and >: speed.
- Home and End: start and end. 0 to 9: jump through the video.
Accessible by default
- Every control is a labeled button, slider or menu, and the controls come back when anything in the player gets focus.
- Autoplay is always muted, and it's skipped for people who prefer reduced motion.
- The players are named by their
title, and cover art is hidden from assistive technology. - If no source can play, an alert says so.
controls="native"switches to the browser's own controls.
Props
VideoPlayer
A video player with brand-styled controls on a native <video>: play, seek (with buffered range), time, volume, captions menu (WebVTT tracks), speed menu, picture in picture, and full screen. List several sources and the browser plays the first format it supports. Keyboard: Space or K play and pause, arrows seek 5s (following reading direction) and change volume, J / L seek 10s, M mutes, C toggles captions, F full screen, < and > change speed, Home / End, and 0 to 9 jump through the video.
| Prop | Type | Default |
|---|---|---|
tracksCaptions, subtitles, or chapters (WebVTT). Prerecorded video with speech needs captions (WCAG 1.2.2). | MediaTrack[] | — |
titleAccessible name of the player, e.g. the video's title. | string | "Video player" |
posterImage shown before playback. | string | — |
widthPlayer width (number = px, or any CSS length). | number | string | "100%" |
heightPlayer height. Usually leave it out and set | number | string | — |
aspectRatioBox shape, e.g. "16 / 9" or "1". | string | the video's own shape |
fitHow the picture fills the box. | "contain""cover" | "contain" |
borderedRounded frame with a border. | boolean | false |
controls
| "custom""native""none" | "custom" |
allowFullscreenOffer full screen (when the browser supports it). | boolean | true |
allowPipOffer picture in picture (when the browser supports it). | boolean | true |
classNameClass name for the player root (the | string | — |
styleStyle for the player root. | CSSProperties | — |
sourcesRequiredFiles to play, in order of preference. | MediaSource[] | — |
playbackRatesPlayback speeds offered in the speed menu. | number[] | [0.5, 1, 1.5, 2] |
autoPlayStart playing when ready. Video autoplay is always muted, and skipped when the viewer prefers reduced motion. | boolean | false |
loopStart from the beginning when it ends. | boolean | false |
mutedStart muted. | boolean | false |
preloadHow much to load before play. | "none""metadata""auto" | "metadata" |
onPlayingChangeCalled when playback starts or stops. | (playing: boolean) => void | — |
labelsOverrides the built-in text (buttons, menus, error). Localize it here. | Partial<Record<"play" | "pause" | "mute" | "unmute" | "volume" | "seek" | "captions" | "speed" | "fullscreen" | "exitFullscreen" | "pip" | "exitPip" | "error", string>> | — |
Also accepts native <video> attributes, plus className, style and ref.
AudioPlayer
An audio player with the same brand controls as VideoPlayer (play, seek, time, volume, speed), plus optional title, artist, and cover art. Same keyboard shortcuts, minus full screen and captions.
| Prop | Type | Default |
|---|---|---|
titleTrack or episode title. Also names the player. | ReactNode | — |
artistArtist, show, or other secondary line. | ReactNode | — |
artworkCover art (an | ReactNode | — |
variant
| "card""plain" | "card" |
classNameClass name for the player root. | string | — |
styleStyle for the player root. | CSSProperties | — |
sourcesRequiredFiles to play, in order of preference. | MediaSource[] | — |
playbackRatesPlayback speeds offered in the speed menu. | number[] | [0.5, 1, 1.5, 2] |
autoPlayStart playing when ready. Video autoplay is always muted, and skipped when the viewer prefers reduced motion. | boolean | false |
loopStart from the beginning when it ends. | boolean | false |
mutedStart muted. | boolean | false |
preloadHow much to load before play. | "none""metadata""auto" | "metadata" |
onPlayingChangeCalled when playback starts or stops. | (playing: boolean) => void | — |
labelsOverrides the built-in text (buttons, menus, error). Localize it here. | Partial<Record<"play" | "pause" | "mute" | "unmute" | "volume" | "seek" | "captions" | "speed" | "fullscreen" | "exitFullscreen" | "pip" | "exitPip" | "error", string>> | — |
Also accepts native <audio> attributes, plus className, style and ref.
MediaSource
One media file. List several in order of preference; the browser plays the first it supports.
| Prop | Type | Default |
|---|---|---|
srcRequiredFile URL. | string | — |
typeMIME type, with codecs when you know them, e.g. | string | — |
MediaTrack
A WebVTT text track: captions, subtitles, or chapters.
| Prop | Type | Default |
|---|---|---|
srcRequired
| string | — |
kind | "captions""subtitles""chapters""descriptions" | "captions" |
srcLangRequiredLanguage code, e.g. "en". | string | — |
labelRequiredName shown in the captions menu, e.g. "English". | string | — |
defaultTurn this track on at first. | boolean | — |