mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31:20 -08:00
38 lines
865 B
JavaScript
38 lines
865 B
JavaScript
import { def } from '../utils';
|
|
|
|
export default function playMix(art, player) {
|
|
const {
|
|
i18n,
|
|
notice,
|
|
constructor: { instances },
|
|
option: { mutex },
|
|
template: { $video },
|
|
} = art;
|
|
|
|
def(player, 'play', {
|
|
value() {
|
|
const promise = $video.play();
|
|
|
|
if (promise && 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');
|
|
|
|
return promise;
|
|
},
|
|
});
|
|
}
|