ValyroUI English version

Media Player

Видео и аудио: свои контролы, субтитры, PiP, полный экран, волна. Pro · Контент и соцсети › Медиа

Установка

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';

Пропсы

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.

Похожие компоненты

  • Media Gallery — Галерея изображений
  • Article Header — Шапка статьи: рубрика, заголовок, лид, авторы и дата
  • Byline — Подпись: авторы, дата публикации и обновления, время чтения
  • Article Figure — Иллюстрация с подписью и автором фото
  • Pull Quote — Выносная цитата с атрибуцией
  • Key Points — Блок «Главное» с ключевыми тезисами
  • Editor Note — Обновление, исправление, раскрытие и пометка о спонсорстве
  • Article Toc — Оглавление статьи с подсветкой текущего раздела
  • Reading Progress — Полоса прогресса чтения
  • Share Bar — Поделиться: Telegram, VK, X, WhatsApp, почта и копирование ссылки
  • Author Bio — Карточка автора в конце статьи с подпиской
  • Article Card — Карточка новости: вертикальная, горизонтальная и поверх фото

Назад: Media Gallery · Далее: Tier List · Весь раздел «Контент и соцсети»