Plus · VideoPlayer
VideoPlayer
Used to play video

Demos

How to import

Basic Usage

For basic usage, pass the video address through src and pass the video cover address through poster

Set controls list

Set the display items of the menu bar through controlsList. The accepted value is an array. The default value is ['play', 'next', 'time', 'volume', 'playbackRate', 'quality', 'route', 'mirror', 'fullscreen', 'pictureInPicture']

Loop playback

Use loop to set loop playback

Fast forward and rewind

Use seekTime to set the fast forward and rewind time, and use the left and right keys on the keyboard to fast forward and rewind.

Playback rate

Set the rate selection list through playbackRateList

Volume setting

Use volume to set the initial volume, the value range is 0 - 100, set muted to true to play silently

Clarity switching

Use qualityList to set the clarity selection list, defaultQuality to set the initial selected clarity, and onQualityChange to set the src logic to be updated after clicking.
Similarly for route switching, use routeList to set the clarity selection list, defaultRoute to set the initial selected route, and onRouteChange to set the src logic to be updated after clicking.

Chapter markers

Set chapter markers via markers

Theme

Set the theme via theme, the theme only affects the background color

API

PropertiesDescriptionTypeDefault Value
autoPlayWhether to play automaticallybooleanfalse
captionsSrccaptions sourcestring-
classNameClass namestring-
clickToPlayWhether to enable click to playbooleantrue
controlsListSet the menu bar to display controls. All controls are displayed by default.string[]['play', 'next', 'time', 'volume', 'playbackRate', 'quality', 'route', 'mirror', 'fullscreen', 'pictureInPicture']
crossOriginThis enum attribute indicates whether CORS is used to fetch the video. CORS-enabled resources can be reused in 'canvas' elements without being polluted. Allowed values ​​are 'anonymous' and 'use-credentials''anonymous' |'use-credentials'-
defaultPlaybackRateDefault playback ratenumber1
defaultPlaybackRateDefault video resolutionstring-
defaultRouteDefault Linestring-
heightheightstring | number-
loopWhether to enable loop playbackbooleanfalse
markersChapter markingMarker[]-
mutedWhether to play silentlybooleanfalse
onPausePause callback() => void-
onPlayPlay callback() => void-
onQualityChangeSwitch quality callback(quality: string) => void-
onRateChangeSwitch rate callback(rate: number) => void-
onRouteChangeSwitch route callback(route: string) => void-
onVolumeChangeAdjust volume callback(volume: number) => void-
playbackRateListRate list, 6 playback rates are displayed by default, namely 0.5, 0.75, 1.0, 1.25, 1.5 and 2.0Array<{ label: string; value: string }>-
posterPosterstring-
qualityListQuality listArray<{ label: string; value: string }>-
routeListRoute listArray<{ label: string; value: string }>-
seekTimeFast forward and rewind timenumber10
srcVideo playback addressstring-
styleStyleCSSProperties-
themeTheme settings, different theme components have different background colors'dark' | 'light''dark'
volumeDefault volumenumber100
widthwidthstring | number-

Marker

PropertiesDescriptionTypeDefault Value
startstart time pointnumber
titletitlestring

Design Token