diff --git a/src/player.js b/src/player.js index 4e270a36e..f4a2814e8 100644 --- a/src/player.js +++ b/src/player.js @@ -437,8 +437,10 @@ _V_.Player.prototype.extend({ // Turn on fullscreen (or window) mode enterFullScreen: function(){ - if (this.supportsFullScreen()) { - this.videoIsFullScreen = true; + this.videoIsFullScreen = true; + if (typeof this.el.webkitRequestFullScreen == 'function') { + this.el.webkitRequestFullScreen(); + } else if (this.supportsFullScreen()) { this.apiCall("enterFullScreen"); } else { this.enterFullWindow(); @@ -448,9 +450,11 @@ _V_.Player.prototype.extend({ }, exitFullScreen: function(){ - if (this.supportsFullScreen()) { - this.videoIsFullScreen = false; - this.apiCall("exitFullScreen"); + this.videoIsFullScreen = false; + if (typeof this.el.webkitRequestFullScreen == 'function') { + document.webkitCancelFullScreen(); + } else if (this.supportsFullScreen()) { + document.webkitExitFullScreen(); } else { this.exitFullWindow(); } diff --git a/src/tech.js b/src/tech.js index 37d441bb9..3341dd4d7 100644 --- a/src/tech.js +++ b/src/tech.js @@ -16,7 +16,7 @@ _V_.PlaybackTech = _V_.Component.extend({ // Create placeholder methods for each that warn when a method // isn't supported by the current playback technology -_V_.apiMethods = "play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,exitFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(","); +_V_.apiMethods = "play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(","); _V_.each(_V_.apiMethods, function(methodName){ _V_.PlaybackTech.prototype[methodName] = function(){ throw new Error("The '"+method+"' method is not available on the playback technology's API"); @@ -128,29 +128,16 @@ _V_.HTML5 = _V_.PlaybackTech.extend({ height: function(){ return this.el.offsetHeight; }, supportsFullScreen: function(){ - if (typeof this.el.webkitRequestFullScreen == 'function') { - return true; - } else if (typeof this.el.webkitEnterFullScreen == 'function') { + if (typeof this.el.webkitEnterFullScreen == 'function') { // Seems to be broken in Chromium/Chrome && Safari in Leopard if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) { return true; } - } else { + } return false; - } }, enterFullScreen: function(){ - if (typeof this.el.webkitRequestFullScreen == 'function') { - try { - this.player.el.webkitRequestFullScreen(); - } catch (e) { - if (e.code == 11) { - // this.warning(VideoJS.warnings.videoNotReady); - _V_.log("VideoJS: Video not ready.") - } - } - } else { try { this.el.webkitEnterFullScreen(); } catch (e) { @@ -159,15 +146,6 @@ _V_.HTML5 = _V_.PlaybackTech.extend({ _V_.log("VideoJS: Video not ready.") } } - } - }, - - exitFullScreen: function(){ - if (typeof this.el.webkitRequestFullScreen == 'function') { - document.webkitCancelFullScreen(); - } else { - document.webkitExitFullScreen(); - } }, src: function(src){ this.el.src = src; }, load: function(){ this.el.load(); },