Hide Picture in Picture button and disable shortcut for audio formats (#2227)

This commit is contained in:
absidue 2022-05-02 13:50:23 +02:00 committed by GitHub
parent cce529172b
commit 1e5895a8c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -1578,7 +1578,7 @@ export default Vue.extend({
// I Key // I Key
event.preventDefault() event.preventDefault()
// Toggle Picture in Picture Mode // Toggle Picture in Picture Mode
if (!this.player.isInPictureInPicture()) { if (this.format !== 'audio' && !this.player.isInPictureInPicture()) {
this.player.requestPictureInPicture() this.player.requestPictureInPicture()
} else if (this.player.isInPictureInPicture()) { } else if (this.player.isInPictureInPicture()) {
this.player.exitPictureInPicture() this.player.exitPictureInPicture()

View File

@ -75,7 +75,8 @@ export default Vue.extend({
playlistId: '', playlistId: '',
timestamp: null, timestamp: null,
playNextTimeout: null, playNextTimeout: null,
playNextCountDownIntervalId: null playNextCountDownIntervalId: null,
pictureInPictureButtonInverval: null
} }
}, },
computed: { computed: {
@ -174,6 +175,21 @@ export default Vue.extend({
} }
break 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 () { mounted: function () {