mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
修复切换画质bug
This commit is contained in:
1 parent
d4b9fc4d29
commit
88533c1023
8 files changed
+116
-138
No files matched your search
@@ -34,7 +34,7 @@ export default class Quality {
|
||||
const index = Number(event.target.dataset.index);
|
||||
const { url, name } = option.quality[index];
|
||||
if (url && name && this.playIndex !== index) {
|
||||
player.switch(url, name);
|
||||
player.switchQuality(url, name);
|
||||
$qualityName.innerHTML = name;
|
||||
this.playIndex = index;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import seekMix from './seekMix';
|
||||
import volumeMix from './volumeMix';
|
||||
import currentTimeMix from './currentTimeMix';
|
||||
import durationMix from './durationMix';
|
||||
import switchMix from './switchMix';
|
||||
import switchQualityMix from './switchQualityMix';
|
||||
import playbackRateMix from './playbackRateMix';
|
||||
import aspectRatioMix from './aspectRatioMix';
|
||||
import screenshotMix from './screenshotMix';
|
||||
@@ -32,7 +32,7 @@ export default class Player {
|
||||
volumeMix(art, this);
|
||||
currentTimeMix(art, this);
|
||||
durationMix(art, this);
|
||||
switchMix(art, this);
|
||||
switchQualityMix(art, this);
|
||||
playbackRateMix(art, this);
|
||||
aspectRatioMix(art, this);
|
||||
screenshotMix(art, this);
|
||||
|
||||
@@ -32,16 +32,6 @@ function nativePip(art, player) {
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'pipToggle', {
|
||||
value: () => {
|
||||
if (player.pipState) {
|
||||
player.pipExit();
|
||||
} else {
|
||||
player.pipEnabled();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
proxy($video, 'enterpictureinpicture', () => {
|
||||
art.emit('pipEnabled');
|
||||
});
|
||||
@@ -117,6 +107,14 @@ function customPip(art, player) {
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export default function pipMix(art, player) {
|
||||
if (document.pictureInPictureEnabled) {
|
||||
nativePip(art, player);
|
||||
} else {
|
||||
customPip(art, player);
|
||||
}
|
||||
|
||||
Object.defineProperty(player, 'pipToggle', {
|
||||
value: () => {
|
||||
@@ -128,11 +126,3 @@ function customPip(art, player) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export default function pipMix(art, player) {
|
||||
if (document.pictureInPictureEnabled) {
|
||||
nativePip(art, player);
|
||||
} else {
|
||||
customPip(art, player);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,13 +3,13 @@ export default function switchMix(art, player) {
|
||||
refs: { $video },
|
||||
i18n,
|
||||
notice,
|
||||
isPlaying,
|
||||
option,
|
||||
} = art;
|
||||
|
||||
Object.defineProperty(player, 'switch', {
|
||||
Object.defineProperty(player, 'switchQuality', {
|
||||
value: (url, name = 'unknown') => {
|
||||
if (url !== option.url) {
|
||||
const { isPlaying } = art;
|
||||
const { currentTime } = player;
|
||||
art.emit('beforeMountUrl', url);
|
||||
$video.src = player.mountUrl(url);
|
||||
Reference in new issue
Block a user