mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 14:41:20 -08:00
修复异步切换画质bug
This commit is contained in:
1 parent
946a2da8a9
commit
2f1e7a0b55
6 files changed
+31
-34
No files matched your search
@@ -15,7 +15,7 @@ export default function attachUrlMix(art, player) {
|
||||
value: url => {
|
||||
const typeName = type || getExt(url);
|
||||
const typeCallback = customType[typeName];
|
||||
sleep().then(() => {
|
||||
return sleep().then(() => {
|
||||
if (typeName && typeCallback) {
|
||||
art.emit('beforeCustomType', typeName);
|
||||
typeCallback($video, player.returnUrl(url), art);
|
||||
|
||||
@@ -23,9 +23,9 @@ export default function eventInit(art, player) {
|
||||
});
|
||||
});
|
||||
|
||||
art.on('video:abort', () => {
|
||||
notice.show(`${i18n.get('Video loading is aborted')}`);
|
||||
});
|
||||
// art.on('video:abort', () => {
|
||||
|
||||
// });
|
||||
|
||||
art.on('video:canplay', () => {
|
||||
if (!firstCanplay) {
|
||||
|
||||
@@ -10,16 +10,17 @@ export default function switchMix(art, player) {
|
||||
if (url !== option.url) {
|
||||
const { isPlaying } = art;
|
||||
const { currentTime } = player;
|
||||
player.attachUrl(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);
|
||||
player.attachUrl(url).then(() => {
|
||||
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);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user