I'm trying to launch fullscreen video on an iPad where the user can touch an image and the video will launch fullscreen.
I have it working, but I have to stop using jQuery for one thing.
$(function(){
// hide video and button until we know they're loaded
$("#myVideo").css({'visibility' : 'hidden', 'display' : 'none'});
$("#fs").css({'visibility' : 'hidden'});
// video is loaded
$("#myVideo").bind('loadedmetadata', function () {
// show button to launch video
$("#fs").css({'visibility' : 'visible'});
});
// extend button functionality
$('#fs').bind('click', function() {
// display the video
$("#myVideo").css({'visibility' : 'visible', 'display' : 'block'});
// launch the video fullscreen
$("#myVideo").webkitEnterFullscreen();
});
});
The click ends up returning Uncaught TypeError: Object [object Object] has no method 'webkitEnterFullscreen'
However, when I change my bind/click to:
// extend button functionality
$('#fs').bind('click', function() {
// display the video
$("#myVideo").css({'visibility' : 'visible', 'display' : 'block'});
// launch the video fullscreen
var vid = document.getElementById("myVideo");
vid.webkitEnterFullscreen();
});
Then it works with no error. What am I doing wrong with my jQuery?