Logo
  Sunday, May 20, 2012
Sign-In  |  Sign-Up  |  Contact Us  | Bookmark |  RSS Feed

HTML5 Tutorial FeedBurner

Opening HTML5 Video in Full Screen Mode  
These days videos come in very good quality and some of the paying sites provide HD quality videos as well. So, it is oftentimes users expand their video players in full screen mode. YouTube allows you to do that as well as myriad other commercially available video players.

HTML5 video control can also be opened in full screen mode with the help of webkitSupportsFullscreen property and webkitEnterFullscreen() method of our video control object. In order to exit out of full screen mode, user needs to press "Esc" button on their keyboard.

Here is HTML5 boilerplate code that allows us to expand and exit full screen mode with ease.

<!DOCTYPE html>

<html>

  <head>

    <title>HTML5 Video Full Screen Mode Example</title>

<script> 

var myVideo; 

window.onload = function()

{

    myVideo= document.getElementById("myVideoFile"); 

    btnfullMode.addEventListener("click", setFullScreenMode, false); 

    video.addEventListener("loadedmetadata", makeFullModeVisible, false);

} 

function makeFullModeVisible()

{

    if (video.webkitSupportsFullscreen)

    {

        document.getElementById("btnfullMode").style.visibility="visible";

    }

} 

function setFullScreenMode()

{

        video.webkitEnterFullscreen();

}

</script> 

</head>

<body> 

  <div id="video_container"> 

<video width="320" height="176" src="myVideoFile.mp4" id="myVideoFile" autoplay /> 

</div>

     <br/> 

     <button type="button" id="btnfullMode" style="visibility:hidden">

     Open Video in Full Screen mode

     </button> 

</body>

</html>

Download HTML5 Full Screen code: Download HTML5 Video Sample Code

Print Opening HTML5 Video in Full Screen Mode Bookmark Opening HTML5 Video in Full Screen Mode

Related Articles  
HTML5 Video Browser Support
There are several major browsers that provide support for HTML5 video codec formats. However, this support is not ...
HTML5 Video Sample Code
In order to create HTML5 video page, we need to create video file itself. There are many different video file formats ...
HTML5 Baseline Codec Media Element
HTML5 baseline codec is a video and audio formats supported by all browsers. As a result, we can rely on this media ...
Custom HTML5 Video Controller
HTML5 video controller allows user to interact with your embedded video just like YouTube video player allows you to ...
HTML5 Video Tag
HTML5 video tag is used to provide video content linkage within your HTML5 webpage. HTML5 video tag has "src" attribute ...
HTML5 Video Conferencing
The HTML5 WebSockets allows HTML5 video conferencing and to share data through our web server with other user browsers. ...
More