Skip to content
This repository
Browse code

Merge pull request #18 from Pike/master

support gecko mozRequestFullScreen api.
  • Loading branch information...
commit f7b96fc2baf8069f5dfcb87152f391a509fa9e5a 2 parents c99d426 + 3158424
Alex MacCaw authored September 09, 2011

Showing 1 changed file with 15 additions and 3 deletions. Show diff stats Hide diff stats

  1. 18  javascripts/flarevideo.js
18  javascripts/flarevideo.js
@@ -34,7 +34,11 @@ $.fn.idleTimer = function(options){
34 34
 
35 35
 var testVideoElement = $("<video />")[0];
36 36
 var nativeSupport    = (typeof testVideoElement.canPlayType != 'undefined');
37  
-var nativeFullScreenSupport = (typeof testVideoElement.webkitEnterFullScreen != 'undefined');
  37
+var nativeFullScreenSupport = (
  38
+  (typeof testVideoElement.webkitEnterFullScreen != 'undefined') ? 'webkit' :
  39
+    (typeof testVideoElement.mozRequestFullScreen != 'undefined') ? 'mozGecko' :
  40
+    false);
  41
+
38 42
 
39 43
 // webkitEnterFullScreen fails under Chrome at the moment
40 44
 if (navigator.userAgent.match('Chrome')) nativeFullScreenSupport = false;
@@ -142,14 +146,22 @@ FlareVideo.fn.togglePlay = function(){
142 146
 FlareVideo.fn.fullScreen = function(state){
143 147
   if (typeof state == "undefined") state = true;
144 148
   this.inFullScreen = state;
145  
-  if (this.options.useNativeFullScreen) {
  149
+  switch (this.options.useNativeFullScreen) {
  150
+  case 'webkit': {
146 151
     this.video[state ? "enterFullScreen" : "exitFullScreen"]();
147  
-  } else {
  152
+    break;
  153
+    }
  154
+  case 'mozGecko': {
  155
+    this.video[state ? "mozRequestFullScreen" : "mozCancelFullScreen"]();
  156
+    break;
  157
+  }
  158
+  default: {
148 159
     (state ? $("body") : this.parent).prepend(this.element);
149 160
     var isPlaying = (this.state == "playing");
150 161
     this.element[state ? "addClass" : "removeClass"]("fullScreen");
151 162
     if (isPlaying) this.ready($.proxy(this.play, this));
152 163
   }
  164
+  }
153 165
 };
154 166
 
155 167
 FlareVideo.fn.toggleFullScreen = function(){

0 notes on commit f7b96fc

Please sign in to comment.
Something went wrong with that request. Please try again.