// Function to make the video fullscreen
function goFullscreen() {
var iframe = document.getElementById(‘video-iframe’);
// Check if the iframe can enter fullscreen
if (iframe.requestFullscreen) {
iframe.requestFullscreen();
} else if (iframe.mozRequestFullScreen) { // Firefox
iframe.mozRequestFullScreen();
} else if (iframe.webkitRequestFullscreen) { // Chrome, Safari
iframe.webkitRequestFullscreen();
} else if (iframe.msRequestFullscreen) { // IE/Edge
iframe.msRequestFullscreen();
}
}
// Trigger fullscreen automatically once the iframe has loaded (onload event)
document.getElementById(‘video-iframe’).onload = function() {
goFullscreen(); // Try to make the video go fullscreen once it’s loaded
};
// Optional: Add an event listener for the fullscreen button
document.getElementById(‘fullscreen-btn’).addEventListener(‘click’, goFullscreen);