mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
规范化play方法
This commit is contained in:
1 parent
11e871ddc8
commit
c5c4cf73eb
29 files changed
+81
-623
No files matched your search
@@ -10,29 +10,26 @@ export default function playMix(art, player) {
|
||||
} = art;
|
||||
|
||||
def(player, 'play', {
|
||||
set(value) {
|
||||
if (value) {
|
||||
const promise = $video.play();
|
||||
if (promise.then) {
|
||||
promise.then().catch(err => {
|
||||
notice.show = err;
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
value() {
|
||||
const promise = $video.play();
|
||||
|
||||
if (mutex) {
|
||||
instances
|
||||
.filter(item => item !== art)
|
||||
.forEach(item => {
|
||||
item.player.pause = true;
|
||||
});
|
||||
}
|
||||
|
||||
notice.show = i18n.get('Play');
|
||||
art.emit('play');
|
||||
} else {
|
||||
player.pause = true;
|
||||
if (promise.then) {
|
||||
promise.then().catch((err) => {
|
||||
notice.show = err;
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
if (mutex) {
|
||||
instances
|
||||
.filter((item) => item !== art)
|
||||
.forEach((item) => {
|
||||
item.player.pause();
|
||||
});
|
||||
}
|
||||
|
||||
notice.show = i18n.get('Play');
|
||||
art.emit('play');
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user