mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
bac873deeb565d900837dbdd7ce2cc9484d51d82
ArtPlayer
ArtPlayer is a modern HTML5 video player
Status
⚠️ This project is WIP and not ready for production use yet!
Demo
Introduction
Install
$ npm install --save artplayer
import Artplayer from 'artplayer';
import 'artplayer/dist/artplayer.css';
OR umd builds are also available
<link rel="stylesheet" href="path/to/artplayer.css" />
<script src="path/to/artplayer.js"></script>
Will expose the global variable to window.Artplayer.
Usage
<div class="artplayer-app"></div>
var app = new Artplayer({
container: '.artplayer-app',
url: 'path/to/video.mp4'
});
Note: You need to initialize a size for the container element, like:
.artplayer-app {
width: 400px;
height: 300px;
}
Configuration
| parameter | description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
container |
Type: string, elementDefault: .artplayerRequired: trueDOM container of the player |
||||||||||
url |
Type: stringDefault: ''Required: trueVideo source url |
||||||||||
poster |
Type: stringDefault: ''Video poster url |
||||||||||
title |
Type: stringDefault: ''Video title, will be shown in screenshot file name and pip mode |
||||||||||
volume |
Type: numberDefault: 0.7Default volume, player will cache the last volume, which may be overwritten |
||||||||||
autoplay |
Type: booleanDefault: falseWhether to play automatically, sometimes it doesn't necessarily succeed More info: autoplay-policy-changes |
||||||||||
autoSize |
Type: booleanDefault: falseKeep the original video aspect ratio and automatically zoom |
||||||||||
loop |
Type: booleanDefault: falseAutomatic loop playback |
||||||||||
playbackRate |
Type: booleanDefault: falseWhether to show playback rate controller in the contextmenu |
||||||||||
aspectRatio |
Type: booleanDefault: falseWhether to show aspect ratio controller in the contextmenu |
||||||||||
screenshot |
Type: booleanDefault: falseWhether to show screenshot controller in the bottom |
||||||||||
setting |
Type: booleanDefault: falseWhether to show setting controller in the bottom |
||||||||||
pip |
Type: booleanDefault: falseWhether to show pip controller in the bottom |
||||||||||
fullscreen |
Type: booleanDefault: falseWhether to show window fullscreen controller in the bottom |
||||||||||
fullscreenWeb |
Type: booleanDefault: falseWhether to show web page fullscreen controller in the bottom |
||||||||||
hotkey |
Type: booleanDefault: trueWhether to use hotkey |
||||||||||
lang |
Type: stringDefault: navigator.language.toLowerCase()Default display language |
||||||||||
theme |
Type: stringDefault: #f00Default theme color |
||||||||||
mutex |
Type: booleanDefault: truePlayer mutually exclusive |
||||||||||
subtitle |
Type: objectDefault: {}Custom subtitle
|
||||||||||
moreVideoAttr |
Type: objectDefault: {'controls': false,'preload': 'auto'}More video Attributes |
||||||||||
quality |
Type: arrayDefault: []Custom quality, The type of quality is an object
|
||||||||||
highlight |
Type: arrayDefault: []Custom highlight, The type of highlight is an object
|
||||||||||
layers |
Type: arrayDefault: []Custom layer, The type of layer is an object
|
||||||||||
contextmenu |
Type: arrayDefault: []Custom contextmenu, The type of layer is an object
|
||||||||||
controls |
Type: arrayDefault: []Custom controls, The type of controls is an object |
API
Ecosystem
| Project | Description |
|---|---|
| artplayer-plugin-danmu | Danmu plugin for ArtPlayer |
Issue
Contributors
License
MIT © Harvey Zack
Languages
JavaScript
89%
Less
9.8%
TypeScript
0.7%
Vue
0.3%
HTML
0.1%