简化player接口

This commit is contained in:
Harvey Zack committed 2019-06-06 10:37:57 +08:00
1 parent 1b69b28ba1
commit 52b6693da2
41 files changed
+624 -690

No files matched your search

+21 -13
View File
@@ -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;
}
},
});
}