Fix fullscreen to maintain aspect ratio
Request fullscreen on player container instead of document root to ensure media maintains aspect ratio with object-fit: contain
This commit is contained in:
parent
54e9303912
commit
45ebe5c0ae
1 changed files with 7 additions and 3 deletions
|
|
@ -32,9 +32,13 @@
|
|||
*/
|
||||
window.toggleFullscreen = function() {
|
||||
if (!document.fullscreenElement) {
|
||||
document.documentElement.requestFullscreen().catch(err => {
|
||||
console.error('Error attempting to enable fullscreen:', err);
|
||||
});
|
||||
// Request fullscreen on the player container, not the whole document
|
||||
const container = document.getElementById('playerContainer');
|
||||
if (container) {
|
||||
container.requestFullscreen().catch(err => {
|
||||
console.error('Error attempting to enable fullscreen:', err);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue