Run a full screen Html5 video

Asked

Viewed 711 times

3

I’m using this solution to load an html that has a js that loads a url from an encrypted video. Everything goes very well however, I need that when giving the first play in the video (click on the webview) the video runs in fullscreen immediately. It is possible?

1 answer

1

Try this:

<video controls id="myvideo">
  <source src="somevideo.webm"></source>
  <source src="somevideo.mp4"></source>
</video>

Javascript:

var elem = document.getElementById("myvideo");
if (elem.requestFullscreen) {
  elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
  elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
  elem.webkitRequestFullscreen();
}
  • I already tried this solution as search on the forums and does not work. Returns me a warning where you can only stay in fullscreen if you have user actions and not by program/ commands. The strange that in iOS when darum play in a video the webview allows to be in full screen at the beginning and on android not. An attempt I would like to make and I don’t know what it was like to call onShowCustomView when playing the video since it controls the fullscreen frame.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.