Skip to content

Instantly share code, notes, and snippets.

@4rn0
Created July 19, 2012 19:34
Show Gist options
  • Save 4rn0/3146246 to your computer and use it in GitHub Desktop.
Save 4rn0/3146246 to your computer and use it in GitHub Desktop.
Trigger fullscreen HTML5 video on iPad
<!DOCTYPE html>
<html>
<head>
<title>Trigger fullscreen HTML5 video on iPad</title>
<style>
#video { height: 1px; opacity: 0; position: absolute; width: 1px; }
#play { width: 100px; }
</style>
</head>
<body>
<video src="http://82.201.53.54:1935/livestream/iphone538.sdp/playlist.m3u8" id="video"></video>
<button id="play">play fullscreen video</button>
<script>
var video = document.getElementById('video'),
play = document.getElementById('play'),
time;
video.addEventListener('webkitbeginfullscreen', function() {
play.innerText = 'play fullscreen video';
window.clearInterval(time);
});
video.addEventListener('webkitendfullscreen', function() {
video.pause();
});
play.addEventListener('touchstart', function() {
time = window.setInterval(function() {
try {
video.webkitEnterFullscreen();
}
catch(e) {}
}, 250);
play.innerText = 'loading ...';
video.play();
});
</script>
</body>
</html>
@hgsadhrakiya
Copy link

It is working very well & helped me to implement the same effect in all the devices ๐Ÿ™‚ ๐Ÿ‘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment