ArtPlayer Video
About 484 words
Overview
The theme provides the capability to embed custom source videos.
This feature is powered by vuepress-plugin-md-power.
Installation
This feature relies on the artplayer player implementation. The theme does not include this dependency by default. When enabling the artPlayer feature, manual installation is required.
npm i artplayerpnpm add artplayeryarn add artplayerThe artPlayer player natively supports video formats including 'mp4', 'mp3', 'webm', and 'ogg'.
It also supports extending compatibility for additional formats.
If your video format is 'mpd' or 'dash', you need to manually install dashjs:
npm i dashjspnpm add dashjsyarn add dashjsIf your video format is 'm3u8' or 'hls', you need to manually install hls.js:
npm i hls.jspnpm add hls.jsyarn add hls.jsIf your video format is 'ts' or 'flv', you need to manually install mpegts.js:
npm i mpegts.jspnpm add mpegts.jsyarn add mpegts.jsConfiguration
This feature is disabled by default. You need to enable it in the theme configuration.
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
markdown: {
artPlayer: true,
},
}),
})Markdown Syntax
@[artPlayer](src)With configuration options:
@[artPlayer muted autoplay loop width="100%" height="400px" ratio="16:9"](src)Parameter Description:
src:string, video source URLwidth:string, video width, defaults to100%height:string, video height, auto by defaultratio:string, video aspect ratio, defaults to16:9type:string, video format, parsed from the video URL by defaultautoplay:boolean, whether to enable autoplay, defaults tofalsemuted:boolean, whether to mute, defaults to followautoplay(truewhen autoplay is enabled)volume:number, volume level, range from0 - 1, defaults to0.75poster:string, video poster image URLauto-mini:boolean, automatically enters mini-player mode when the player scrolls out of the browser viewport, defaults tofalse
Global Component
The theme provides a global component <ArtPlayer /> to support more flexible and comprehensive usage.
Props
For more Props, please refer to the artPlayer documentation. The theme supports all available options.
Examples
Note
The video resources in the examples are sourced from artplayer.org.
Input:
@[artPlayer](https://artplayer.org/assets/sample/video.mp4)Output:
Input:
<ArtPlayer
src="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"
fullscreen
/>Output:
Explanation
The markdown syntax @[artPlayer](src) is internally converted to the <ArtPlayer /> component, which is equivalent to:
<ArtPlayer
src="src"
fullscreen
flip
playback-rate
aspect-ratio
setting
pip
/>