Movatterモバイル変換


[0]ホーム

URL:


Looking for the old docs? Go here
K
GitHub
Twitter
Theme
K

Layouts

Default Layout

A guide on how to setup the default audio/video layout and available customization options.

Installation

Section titled Installation

See theinstallation guide to setup the Default Layout.

Demo

Section titled Demo

You can try out the Default Layout on ourplayer demo page.

Usage

Section titled Usage

The Default Layout ships with support for audio, video, and live streams. You can include bothlayouts at the same time, only one will be matched depending on the view type.

By default, the view type is inferred from the provider and media type. You can specify the desiredtype like so:

The same is true for thestream type:

Color Scheme

Section titled Color Scheme

Both the audio and video layout accept color scheme to be either light or dark themed. By defaultit will use the user’spreferred color scheme. You can set a specifictheme by setting thecolorScheme prop on the layout like so:

You can also set the color scheme by setting alight ordark class on a parent element:

Size

Section titled Size

Both the audio and video layout will adapt to small containers to ensure an optimal user experience.You configure when the small layout is displayed like so:

If you’d like to disable small layouts, set the query tofalse or'never':

Icons

Section titled Icons

You can easily replace the icons used in the layouts to match the style of your application likeso:

tsx

Thumbnails

Section titled Thumbnails

You can provide thumbnails which will be used to display preview images when interacting withthe time slider and in the chapters menu. See theloading thumbnails guidefor more information.

Language

Section titled Language

Both the audio and video layout support internationalization (i18n) by accepting custom languagetranslations. You can dynamically set thetranslations property to update the language like so:

ts

CSS Variables

Section titled CSS Variables

The following snippets contain a complete list of CSS variables and their respective default values.They can all be adjusted by you to customize the audio/video layout and child components as desired.

Audio Layout

Section titled Audio Layout

The following variables can be used to specifically customize the audio layout. See theComponents section for more.

css

Video Layout

Section titled Video Layout

The following variables can be used to specifically customize the video layout. See theComponents section for more.

css

Components

Section titled Components
css

Slots

Section titled Slots

Audio Layout

Section titled Audio Layout

Theslots prop can be used to insert or replace content inside theDefaultAudioLayout. You canfind all availableslot positions below.

tsx

Video Layout

Section titled Video Layout

Theslots prop can be used to insert or replace content inside theDefaultVideoLayout. You canfind all availableslot positions below.

tsx

Content can be slotted inside specific video layout sizes like so:

tsx

Positions

Section titled Positions

The following slot positions are available for inserting or replacing content:

  • bufferingIndicator
  • captionButton
  • captions
  • title
  • chapterTitle
  • currentTime
  • endTime
  • fullscreenButton
  • liveButton
  • livePlayButton
  • muteButton
  • pipButton
  • airPlayButton
  • googleCastButton
  • playButton
  • loadButton
  • seekBackwardButton
  • seekForwardButton
  • startDuration
  • timeSlider
  • volumeSlider
  • chaptersMenu
  • settingsMenu
  • settingsMenuItemsStart
  • settingsMenuItemsEnd
  • playbackMenuItemsStart
  • playbackMenuItemsEnd
  • playbackMenuLoop
  • accessibilityMenuItemsStart
  • accessibilityMenuItemsEnd
  • audioMenuItemsStart
  • audioMenuItemsEnd
  • captionsMenuItemsStart
  • captionsMenuItemsEnd
INFO

Any slot position can be prefixed with eitherbefore orafter to insert content before orafter that position. For example,afterCaptionButton will insert content after the captionbutton.

API Reference

Section titled API Reference
RefAttributes

The audio layout is our production-ready UI that's displayed when the media view type is set to'audio'. It includes support for audio tracks, slider chapters, captions, live streamsand more out of the box.

import { DefaultAudioLayout }from "@vidstack/react/player/layouts/plyr";
<MediaPlayer src="audio.mp3">  <MediaProvider />  <DefaultAudioLayout icons={defaultLayoutIcons} /></MediaPlayer>
PropTypeDefault
ReactNode
null
DefaultLayoutIcons
undefined
undefined
FileDownloadInfo
undefined
number
700
number
0
boolean
false
`({ width, height }) => width < 576 || height < 380`
ThumbnailSrc
undefined
Partial<DefaultLayoutTranslations>
undefined
`document.body`
undefined
boolean
undefined
undefined
boolean
undefined
boolean
undefined
number
undefined
boolean
undefined
boolean
undefined
boolean
undefined
undefined
number
undefined
DefaultAudioLayoutSlots
undefined
boolean
false
/* Example. */.component[data-foo] {}
NameDescription
data-match
Whether this layout is being used.
data-sm
The small layout is active
data-lg
The large layout is active.
data-size
The active layout size (sm or lg).
RefAttributes

The video layout is our production-ready UI that's displayed when the media view type is set to'video'. It includes support for picture-in-picture, fullscreen, slider chapters, sliderpreviews, captions, audio/quality settings, live streams, and more out of the box.

import { DefaultVideoLayout }from "@vidstack/react/player/layouts/plyr";
<MediaPlayer src="video.mp4">  <MediaProvider />  <DefaultVideoLayout thumbnails="/thumbnails.vtt" icons={defaultLayoutIcons} /></MediaPlayer>
PropTypeDefault
ReactNode
null
DefaultLayoutIcons
undefined
undefined
FileDownloadInfo
undefined
number
700
number
0
boolean
false
`({ width, height }) => width < 576 || height < 380`
ThumbnailSrc
undefined
Partial<DefaultLayoutTranslations>
undefined
`document.body`
undefined
boolean
undefined
undefined
boolean
undefined
boolean
undefined
number
undefined
boolean
undefined
boolean
undefined
boolean
undefined
undefined
number
undefined
DefaultVideoLayoutSlots
undefined
boolean
false
/* Example. */.component[data-foo] {}
NameDescription
data-match
Whether this layout is being used.
data-sm
The small layout is active
data-lg
The large layout is active.
data-size
The active layout size (sm or lg).

[8]ページ先頭

©2009-2025 Movatter.jp