I'm trying to make a video (or anything else) go into a fullscreen mode in the Edge browser through JavaScript. But I can't get it to work. In Chrome everything works as expected.
I tried all steps in the js command line tool. The correct html video element is fetched with the line document.getElementById("video_player");
. Then I tried to enter the command video.requestFullscreen();
, but it's not doing anything. Not even an error :(
I have activated the fullscreen API in the about: flags settings and I've turned off all browser extension.
The HTML video element is not inside an <iframe>
EDIT:
This is my full code. The js file is loaded at the end of the HTML document. As you can see it's not doing much right now.
console.log("Running");
var video = document.getElementById("video_player");
FullScreenStart();
function FullScreenStart(){
console.log("AutoFullScreen started");
console.log(video);
if (video.requestFullscreen) {
video.requestFullscreen();
} else if (video.mozRequestFullScreen) {
video.mozRequestFullScreen();
} else if (video.webkitRequestFullscreen) {
video.webkitRequestFullscreen();
} else if (video.msRequestFullscreen) {
video.msRequestFullscreen();
}
}
function FullScreenOn(){
console.log("FullScreen activated");
}
function FullScreenOff(){
console.log("FullScreen deactivated");
}
document.onwebkitfullscreenchange = function(evt) {
if(document.webkitIsFullScreen){
FullScreenOn();
} else {
FullScreenOff();
}
};
Please, can somebody help me to get this to work? I've wasted two days on this problem now.