diff --git a/src/renderer/components/ft-video-player/ft-video-player.js b/src/renderer/components/ft-video-player/ft-video-player.js index f50c888e..9b9f0816 100644 --- a/src/renderer/components/ft-video-player/ft-video-player.js +++ b/src/renderer/components/ft-video-player/ft-video-player.js @@ -1578,7 +1578,7 @@ export default Vue.extend({ // I Key event.preventDefault() // Toggle Picture in Picture Mode - if (!this.player.isInPictureInPicture()) { + if (this.format !== 'audio' && !this.player.isInPictureInPicture()) { this.player.requestPictureInPicture() } else if (this.player.isInPictureInPicture()) { this.player.exitPictureInPicture() diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 30927717..c08040f9 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -75,7 +75,8 @@ export default Vue.extend({ playlistId: '', timestamp: null, playNextTimeout: null, - playNextCountDownIntervalId: null + playNextCountDownIntervalId: null, + pictureInPictureButtonInverval: null } }, computed: { @@ -174,6 +175,21 @@ export default Vue.extend({ } break } + }, + activeFormat: function (format) { + clearInterval(this.pictureInPictureButtonInverval) + + // only hide/show the button once the player is available + this.pictureInPictureButtonInverval = setInterval(() => { + if (!this.hidePlayer) { + if (format === 'audio') { + document.querySelector('.vjs-picture-in-picture-control').classList.add('vjs-hidden') + } else { + document.querySelector('.vjs-picture-in-picture-control').classList.remove('vjs-hidden') + } + clearInterval(this.pictureInPictureButtonInverval) + } + }, 100) } }, mounted: function () {