mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 21:01:20 -08:00
28 lines
724 B
JavaScript
28 lines
724 B
JavaScript
export default function playMix(art, player) {
|
|
const {
|
|
template: { $video },
|
|
i18n,
|
|
notice,
|
|
option: { mutex },
|
|
} = 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);
|
|
});
|
|
}
|
|
|
|
if (mutex) {
|
|
art.constructor.instances.filter(item => item !== art).forEach(item => item.player.pause());
|
|
}
|
|
|
|
notice.show(i18n.get('Play'));
|
|
art.emit('play');
|
|
},
|
|
});
|
|
}
|