优化回调分离

This commit is contained in:
Harvey Zack committed 2018-11-15 14:24:12 +08:00
1 parent 4b61098945
commit ac1ba12767
11 files changed
+108 -53

No files matched your search

+13 -11
View File
@@ -3,18 +3,20 @@ export default function switchMix(art, player) {
Object.defineProperty(player, 'switch', {
value: (url, name = 'unknown') => {
const { currentTime } = player;
art.emit('beforeMountUrl', url);
$video.src = player.mountUrl(url);
option.url = url;
player.playbackRateRemove();
player.aspectRatioRemove();
player.seek(currentTime);
if (isPlaying) {
player.play();
if (url !== option.url) {
const { currentTime } = player;
art.emit('beforeMountUrl', url);
$video.src = player.mountUrl(url);
option.url = url;
player.playbackRateRemove();
player.aspectRatioRemove();
player.seek(currentTime);
if (isPlaying) {
player.play();
}
notice.show(`${i18n.get('Switch video')}: ${name}`);
art.emit('switch', url);
}
notice.show(`${i18n.get('Switch video')}: ${name}`);
art.emit('switch', url);
}
});
}