HTML5 Canvas how to set video component fullscreen with script
I would like to know how I can set the video component to full screen with script. (Not with actionscript off course for it is for html5)
I would like to know how I can set the video component to full screen with script. (Not with actionscript off course for it is for html5)
idkoos wrote
The given answer is for people who are able to work with a HTML editor.
The given answer is for JavaScript, which is the scripting language Canvas uses.
This function will fullscreen a video of a fixed name. If needed, you could modify it to pass in the name as an argument.
function doFullscreen() {
var vid = document.getElementById("myVideo");
if (vid.requestFullscreen) {
vid.requestFullscreen();
}
else if (vid.msRequestFullscreen) {
vid.msRequestFullscreen();
}
else if (vid.mozRequestFullScreen) {
vid.mozRequestFullScreen();
}
else if (vid.webkitRequestFullscreen) {
vid.webkitRequestFullscreen();
}
}
Of course, all this faffing about is why I just enable the browser's native media controls, which always include a fullscreen button.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.