ValyroUI Русская версия

Media Player

Video and audio: custom controls, captions, PiP, fullscreen, waveform. Pro · Content and social › Media

Video and audio player with custom controls, captions, keyboard shortcuts and an audio waveform.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add media-player
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { MediaPlayer } from 'valyro-ui-pro';

Props

PropTypeDefault
src *stringMedia URL: a file, a blob: URL or anything the browser plays natively.
typestringMIME type of src, e.g. "video/webm".
variant'video' | 'audio''video'video overlays controls on the picture; audio is a compact card with a waveform. Default video.
posterstringImage shown before playback (video).
titleReactNodeVideo: shown over the picture with the controls. Audio: the track name.
artistReactNodeAudio: artist or show under the title.
artworkReactNodeAudio: cover art, e.g. an <img>.
tracksMediaPlayerTrack[][]WebVTT caption tracks; the first default one (or the first) is used by the captions button.
autoPlaybooleanStart playing as soon as possible (browsers allow it only when muted).
loopbooleanStart over at the end.
defaultMutedbooleanfalseStart muted (needed for autoplay in most browsers).
preload'none' | 'metadata' | 'auto''metadata'How much to load before playback. Default metadata (duration and first frame).
crossOrigin'anonymous' | 'use-credentials'CORS mode for media on another origin; needed there for the computed waveform and captions.
playbackRatesnumber[][0.5, 0.75, 1, 1.25, 1.5, 2]Speeds in the speed menu. Default 0.5–2.
peaksnumber[]Audio waveform, values 0–1. Default: computed from the audio (needs a same-origin or CORS-enabled src) once playback starts, or on mount with preload="auto"; files over 20 MB keep a plain track.
aspectRatiostring'16 / 9'Video frame ratio before the media loads, e.g. "16 / 9". Default 16 / 9.
skipSecondsnumberSeconds moved by the skip buttons, J/L and the scrubber's Page keys. Default 10 (video), 15 (audio).
mediaRefRef<HTMLVideoElement | HTMLAudioElement>The underlying <video> or <audio> element.
localestringBCP 47 locale for the speed labels. Default: the ThemeProvider locale, then the browser's.
labelsPartial<MediaPlayerLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

  • Media Gallery — Image gallery
  • Article Header — Article header: section, headline, lede, authors and date
  • Byline — Byline: authors, published and updated dates, reading time
  • Article Figure — Image with caption and photo credit
  • Pull Quote — Pull quote with attribution
  • Key Points — “Key points” summary block
  • Editor Note — Update, correction, disclosure and sponsored-content notes
  • Article Toc — Article table of contents that tracks the current section
  • Reading Progress — Reading progress bar
  • Share Bar — Share: Telegram, VK, X, WhatsApp, email and copy link
  • Author Bio — Author card at the end of an article, with a follow button
  • Article Card — News card: vertical, horizontal and over a photo

Previous: Media Gallery · Next: Tier List · All Content and social