I need some help. This orientationchange code for video doesn't work for me at all. Just using it I give Play to the video and turn the mobile shows full screen. Then you can't get out of there.
var vid = document.querySelector("video");
window.addEventListener("orientationchange", function() {
//(if) Para todos los
navegadores
if (vid.requestFullscreen) {
vid.requestFullscreen();
} else {
//Solo para Chrome
vid.webkitRequestFullscreen();
}
}, false);
You need to analyze the orientation of the device to analyze if you enter full screen or not.
window.orientation
has 4 possible values: 0, 180 for horizontal and 90, -90 for vertical.Reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/orientation