mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
简化player接口
This commit is contained in:
1 parent
1b69b28ba1
commit
52b6693da2
41 files changed
+624
-690
No files matched your search
@@ -7,21 +7,29 @@ export default function playMix(art, player) {
|
||||
} = art;
|
||||
|
||||
Object.defineProperty(player, 'play', {
|
||||
value: () => {
|
||||
const promise = $video.play();
|
||||
if (promise !== undefined) {
|
||||
promise.then().catch(err => {
|
||||
notice.show(err, true, 3000);
|
||||
console.warn(err);
|
||||
});
|
||||
}
|
||||
set(value) {
|
||||
if (value) {
|
||||
const promise = $video.play();
|
||||
if (promise !== undefined) {
|
||||
promise.then().catch(err => {
|
||||
notice.show(err, true, 3000);
|
||||
console.warn(err);
|
||||
});
|
||||
}
|
||||
|
||||
if (mutex) {
|
||||
art.constructor.instances.filter(item => item !== art).forEach(item => item.player.pause());
|
||||
}
|
||||
if (mutex) {
|
||||
art.constructor.instances
|
||||
.filter(item => item !== art)
|
||||
.forEach(item => {
|
||||
item.player.pause = true;
|
||||
});
|
||||
}
|
||||
|
||||
notice.show(i18n.get('Play'));
|
||||
art.emit('play');
|
||||
notice.show(i18n.get('Play'));
|
||||
art.emit('play');
|
||||
} else {
|
||||
player.pause = true;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user