@carlos.salmancaThe PictureInPictureToggleButton component checks the player viewMode to determine PIP support, which currently returns not available, causing the button to be hidden. You can enable/disable PIP using the native browser APIs. Here is a sample implementation.
let pipButton = new bitmovin.playerui.ToggleButton({ cssClass: 'ui-piptogglebutton' });
pipButton.onClick.subscribe(async function () {
try {
if (videoElement !== document.pictureInPictureElement) {
await videoElement.requestPictureInPicture();
} else {
await document.exitPictureInPicture();
}
}
catch (error) {
console.log('' + error);
}
});
let controlBar = new ControlBar({
components: [
/*Other components*/
new Container({
components: [
/*Other components*/
pipButton,
]
})
]
})
If your browser supports PIP APIs (like Chrome or Safari), the button will just show up in your original example @carlos.salmanca (using player 8.166.0 or newer). This is the recommended approach.