Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderer/components/ft-video-player/ft-video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 17 additions & 1 deletion src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export default Vue.extend({
playlistId: '',
timestamp: null,
playNextTimeout: null,
playNextCountDownIntervalId: null
playNextCountDownIntervalId: null,
pictureInPictureButtonInverval: null
}
},
computed: {
Expand Down Expand Up @@ -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 () {
Expand Down