修复切换画质bug

This commit is contained in:
Harvey Zack committed 2018-11-22 13:16:00 +08:00
1 parent d4b9fc4d29
commit 88533c1023
8 files changed
+116 -138

No files matched your search

+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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);
+8 -18
View File
@@ -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);
}
}
@@ -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);