mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
39 lines
916 B
JavaScript
39 lines
916 B
JavaScript
import { def } from '../utils';
|
|
|
|
export default function playMix(art) {
|
|
const {
|
|
i18n,
|
|
notice,
|
|
option,
|
|
constructor: { instances },
|
|
template: { $video },
|
|
} = art;
|
|
|
|
def(art, 'play', {
|
|
value() {
|
|
const promise = $video.play();
|
|
|
|
if (promise && promise.then) {
|
|
promise.then().catch((err) => {
|
|
notice.show = err;
|
|
throw err;
|
|
});
|
|
}
|
|
|
|
if (option.mutex) {
|
|
for (let index = 0; index < instances.length; index++) {
|
|
const instance = instances[index];
|
|
if (instance !== art) {
|
|
instance.pause();
|
|
}
|
|
}
|
|
}
|
|
|
|
notice.show = i18n.get('Play');
|
|
art.emit('play');
|
|
|
|
return promise;
|
|
},
|
|
});
|
|
}
|