mirror of https://github.com/FreeTubeApp/FreeTube
Better solution for hiding the PIP button for the audio formats (#3174)
* Better solution for hiding the PIP button for the audio formats * Add comment Co-authored-by: PikachuEXE <pikachuexe@gmail.com> --------- Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
This commit is contained in:
parent
38fe74a4c6
commit
4c65982371
|
@ -364,6 +364,13 @@ export default defineComponent({
|
|||
await this.determineDefaultQualityLegacy()
|
||||
}
|
||||
|
||||
if (this.format === 'audio') {
|
||||
// hide the PIP button for the audio formats
|
||||
const controlBarItems = this.dataSetup.controlBar.children
|
||||
const index = controlBarItems.indexOf('pictureInPictureToggle')
|
||||
controlBarItems.splice(index, 1)
|
||||
}
|
||||
|
||||
this.player = videojs(this.$refs.video, {
|
||||
html5: {
|
||||
preloadTextTracks: false,
|
||||
|
|
|
@ -98,7 +98,6 @@ export default defineComponent({
|
|||
timestamp: null,
|
||||
playNextTimeout: null,
|
||||
playNextCountDownIntervalId: null,
|
||||
pictureInPictureButtonInverval: null,
|
||||
infoAreaSticky: true
|
||||
}
|
||||
},
|
||||
|
@ -212,25 +211,6 @@ export default defineComponent({
|
|||
}
|
||||
break
|
||||
}
|
||||
},
|
||||
activeFormat: function (format) {
|
||||
clearInterval(this.pictureInPictureButtonInverval)
|
||||
|
||||
// only hide/show the button once the player is available
|
||||
this.pictureInPictureButtonInverval = setInterval(() => {
|
||||
if (!this.hidePlayer) {
|
||||
const pipButton = document.querySelector('.vjs-picture-in-picture-control')
|
||||
if (pipButton === null) {
|
||||
return
|
||||
}
|
||||
if (format === 'audio') {
|
||||
pipButton.classList.add('vjs-hidden')
|
||||
} else {
|
||||
pipButton.classList.remove('vjs-hidden')
|
||||
}
|
||||
clearInterval(this.pictureInPictureButtonInverval)
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
|
|
Loading…
Reference in New Issue