mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
update docs
This commit is contained in:
1 parent
a0bc4d3a39
commit
1388df955f
16 files changed
+11133
-59
No files matched your search
@@ -5,9 +5,19 @@ export default function attrInit(art, player) {
|
||||
Object.keys(option.moreVideoAttr).forEach(key => {
|
||||
$video[key] = option.moreVideoAttr[key];
|
||||
});
|
||||
$video.volume = clamp(option.volume, 0, 1);
|
||||
$video.poster = option.poster;
|
||||
$video.autoplay = option.autoplay;
|
||||
|
||||
if (option.volume) {
|
||||
$video.volume = clamp(option.volume, 0, 1);
|
||||
}
|
||||
|
||||
if (option.poster) {
|
||||
$video.poster = option.poster;
|
||||
}
|
||||
|
||||
if (option.autoplay) {
|
||||
$video.autoplay = option.autoplay;
|
||||
}
|
||||
|
||||
sleep().then(() => {
|
||||
art.emit('beforeMountUrl', option.url);
|
||||
$video.src = player.mountUrl(option.url);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import validElement from './validElement';
|
||||
import validStringEmpty from './validStringEmpty';
|
||||
|
||||
export default {
|
||||
container: {
|
||||
@@ -7,7 +8,8 @@ export default {
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
required: true
|
||||
required: true,
|
||||
validator: validStringEmpty
|
||||
},
|
||||
title: 'string',
|
||||
volume: 'number',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ArtPlayerError } from '../utils';
|
||||
export default function validElement(paths, value, type) {
|
||||
if (type === 'string') {
|
||||
if (value.trim() === '') {
|
||||
throw new ArtPlayerError(`${paths.join('.')} can not be empty'`);
|
||||
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ArtPlayerError } from '../utils';
|
||||
|
||||
export default function validStringEmpty(paths, value, type) {
|
||||
if (type !== 'string') {
|
||||
throw new ArtPlayerError(`${paths.join('.')} required 'string' type.`);
|
||||
}
|
||||
|
||||
if (value.trim() === '') {
|
||||
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
&.artplayer-pip {
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
right: 20px;
|
||||
bottom: 20px;
|
||||
width: 400px;
|
||||
|
||||
Reference in new issue
Block a user