Added picture-in-picture button to video player and search filter for manage content page

This commit is contained in:
Trevor Mears
2026-01-09 15:38:37 -08:00
parent e8e6ba27d7
commit 53a54c760c
4 changed files with 113 additions and 5 deletions
+25
View File
@@ -267,6 +267,13 @@ class VideoPlayer {
this.toggleFullscreen();
});
// Picture-in-Picture
const btnPip = document.getElementById('btn-pip');
btnPip?.addEventListener('click', (e) => {
e.stopPropagation();
this.togglePictureInPicture();
});
this.container.addEventListener('dblclick', () => this.toggleFullscreen());
// Overlay Auto-hide Logic
@@ -325,6 +332,24 @@ class VideoPlayer {
}
}
/**
* Toggle Picture-in-Picture mode
*/
async togglePictureInPicture() {
try {
if (document.pictureInPictureElement) {
await document.exitPictureInPicture();
} else if (document.pictureInPictureEnabled && this.video.readyState >= 2) {
await this.video.requestPictureInPicture();
}
} catch (err) {
// Silently fail - Firefox users can use native PiP button
if (err.name !== 'NotAllowedError') {
console.error('Picture-in-Picture error:', err);
}
}
}
/**