mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
切换视频后播放按钮bug
This commit is contained in:
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();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -38,9 +38,6 @@ function nativePip(art, player) {
|
||||
|
||||
proxy($video, 'leavepictureinpicture', () => {
|
||||
art.emit('pipExit');
|
||||
if (player.playing) {
|
||||
player.play();
|
||||
}
|
||||
});
|
||||
|
||||
art.on('destroy', () => {
|
||||
|
||||
Reference in new issue
Block a user