Is there any way to do this? I wan to play video in full screen. Without browser. setting width:100%; height:100%;
keep browser visible yet
All hail HTML5 _/\_
var videoElement = document.getElementById('videoId');
videoElement.webkitRequestFullScreen();
You can use html5 video player which has full screen playback option.
This is a very good html5 player to have a look.
http://sublimevideo.net/
Here is a very simple way (3 lines of code) using the Fullscreen API and RequestFullscreen method that I used, which is compatible across all popular browsers:
var elem = document.getElementsByTagName('video')[0];
var fullscreen = elem.webkitRequestFullscreen || elem.mozRequestFullScreen || elem.msRequestFullscreen;
fullscreen.call(elem); // bind the 'this' from the video object and instantiate the correct fullscreen method.
For browser compatibility: MDN & Can I use
if (vi_video[0].exitFullScreen) vi_video[0].exitFullScreen();
else if (vi_video[0].webkitExitFullScreen) vi_video[0].webkitExitFullScreen();
else if (vi_video[0].mozExitFullScreen) vi_video[0].mozExitFullScreen();
else if (vi_video[0].oExitFullScreen) vi_video[0].oExitFullScreen();
else if (vi_video[0].msExitFullScreen) vi_video[0].msExitFullScreen();
else { vi_video.parent().append(vi_video.remove()); }
No, there is no way to do this yet. I wish they add a future like this in browsers.
EDIT:
Now there is a Full Screen API for the web You can requestFullscreen
on an Video or Canvas element to ask user to give you permisions and make it full screen.
Let's consider this element:
<video controls id="myvideo">
<source src="somevideo.webm"></source>
<source src="somevideo.mp4"></source>
</video>
We can put that video into fullscreen mode with script like this:
var elem = document.getElementById("myvideo");
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
Full documentation
Add object-fit: cover to the style of video
<video controls style="object-fit: cover;" >