I have a button that clicking on it should open a PIP and open a new tab.
The issue is that if when I use them together, the browser blocks the new tab.
I have tried setTimeout and switch the order of the actions.
This is the code of the PIP:
const togglePictureInPicture = (video: HTMLVideoElement) => {
if (document.pictureInPictureElement) {
document.exitPictureInPicture()
} else {
if (document.pictureInPictureEnabled) {
video.requestPictureInPicture()
}
}
The code of the opening a tab is a simple window.open('_blank')