mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 20:53:21 -08:00
build all packages
This commit is contained in:
1 parent
9de6e12671
commit
3b172ffa93
31 files changed
+447
-58
No files matched your search
@@ -0,0 +1,43 @@
|
||||
export default function switchMix(art, player) {
|
||||
const { i18n, notice, option } = art;
|
||||
|
||||
Object.defineProperty(player, 'switchQuality', {
|
||||
value: (url, name = 'unknown') => {
|
||||
if (url !== option.url) {
|
||||
const { currentTime, playing } = player;
|
||||
return player.attachUrl(url).then(() => {
|
||||
option.url = url;
|
||||
player.playbackRateRemove();
|
||||
player.aspectRatioRemove();
|
||||
player.seek(currentTime);
|
||||
if (playing) {
|
||||
player.play();
|
||||
}
|
||||
notice.show(`${i18n.get('Switch video')}: ${name}`);
|
||||
art.emit('switch', url);
|
||||
});
|
||||
}
|
||||
return null;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'switchUrl', {
|
||||
value: (url, name = 'unknown') => {
|
||||
if (url !== option.url) {
|
||||
const { playing } = player;
|
||||
return player.attachUrl(url).then(() => {
|
||||
option.url = url;
|
||||
player.playbackRateRemove();
|
||||
player.aspectRatioRemove();
|
||||
player.seek(0);
|
||||
if (playing) {
|
||||
player.play();
|
||||
}
|
||||
notice.show(`${i18n.get('Switch video')}: ${name}`);
|
||||
art.emit('switch', url);
|
||||
});
|
||||
}
|
||||
return null;
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user