I answered my question, the key is that the user controls are inside the <div>
, which includes the video that you want to use in full screen. In my code below, this <div>
is called "videoContainer".
Here is the link I used to figure this out. http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html
here's the js code for entering and exiting fullscreen in webkit and mozilla browsers:
var $video=$('video'); //fullscreen button clicked $('#fullscreenBtn').on('click', function() { $(this).toggleClass('enterFullscreenBtn'); if($.isFunction($video.get(0).webkitEnterFullscreen)) { if($(this).hasClass("enterFullscreenBtn")) document.getElementById('videoContainer').webkitRequestFullScreen(); else document.webkitCancelFullScreen(); } else if ($.isFunction($video.get(0).mozRequestFullScreen)) { if($(this).hasClass("enterFullscreenBtn")) document.getElementById('videoContainer').mozRequestFullScreen(); else document.mozCancelFullScreen(); } else { alert('Your browsers doesn\'t support fullscreen'); } });
and here is the HTML:
<div id="videoContainer"> <video>...<source></source> </video> <div> custom controls <button>play/pause</button> <button id="fullscreenBtn" class="enterFullscreenBtn">fullscreen</button> </div> </div>
source share