切换视频后播放按钮bug

This commit is contained in:
Harvey Zack committed 2018-11-29 09:16:19 +08:00
1 parent efbd7c08f4
commit 43a90ae379
5 files changed
+43 -23

No files matched your search

@@ -10,12 +10,11 @@ export default function playAndPause(controlOption) {
player,
i18n,
} = art;
const $play = append($control, icons.play);
const $pause = append($control, icons.pause);
tooltip($play, i18n.get('Play'));
tooltip($pause, i18n.get('Pause'));
setStyle($pause, 'display', 'none');
proxy($play, 'click', () => {
player.play();
@@ -25,14 +24,28 @@ export default function playAndPause(controlOption) {
player.pause();
});
art.on('video:playing', () => {
function showPlay() {
setStyle($play, 'display', 'flex');
setStyle($pause, 'display', 'none');
}
function showPause() {
setStyle($play, 'display', 'none');
setStyle($pause, 'display', 'flex');
}
if (player.playing) {
showPause();
} else {
showPlay();
}
art.on('video:playing', () => {
showPause();
});
art.on('video:pause', () => {
setStyle($play, 'display', 'flex');
setStyle($pause, 'display', 'none');
showPlay();
});
},
});
-3
View File
@@ -38,9 +38,6 @@ function nativePip(art, player) {
proxy($video, 'leavepictureinpicture', () => {
art.emit('pipExit');
if (player.playing) {
player.play();
}
});
art.on('destroy', () => {