Browse files

support mozRequestFullScreen experimental api

Support the fullscreen api added in Gecko 9. Make sure that you have
full-screen-api.enabled set to true.
  • Loading branch information...
1 parent c99d426 commit 315842434ac35d681eb8b9f8d02db0989176cb17 @Pike Pike committed Sep 9, 2011
Showing with 15 additions and 3 deletions.
  1. +15 −3 javascripts/flarevideo.js
View
18 javascripts/flarevideo.js
@@ -34,7 +34,11 @@ $.fn.idleTimer = function(options){
var testVideoElement = $("<video />")[0];
var nativeSupport = (typeof testVideoElement.canPlayType != 'undefined');
-var nativeFullScreenSupport = (typeof testVideoElement.webkitEnterFullScreen != 'undefined');
+var nativeFullScreenSupport = (
+ (typeof testVideoElement.webkitEnterFullScreen != 'undefined') ? 'webkit' :
+ (typeof testVideoElement.mozRequestFullScreen != 'undefined') ? 'mozGecko' :
+ false);
+
// webkitEnterFullScreen fails under Chrome at the moment
if (navigator.userAgent.match('Chrome')) nativeFullScreenSupport = false;
@@ -142,14 +146,22 @@ FlareVideo.fn.togglePlay = function(){
FlareVideo.fn.fullScreen = function(state){
if (typeof state == "undefined") state = true;
this.inFullScreen = state;
- if (this.options.useNativeFullScreen) {
+ switch (this.options.useNativeFullScreen) {
+ case 'webkit': {
this.video[state ? "enterFullScreen" : "exitFullScreen"]();
- } else {
+ break;
+ }
+ case 'mozGecko': {
+ this.video[state ? "mozRequestFullScreen" : "mozCancelFullScreen"]();
+ break;
+ }
+ default: {
(state ? $("body") : this.parent).prepend(this.element);
var isPlaying = (this.state == "playing");
this.element[state ? "addClass" : "removeClass"]("fullScreen");
if (isPlaying) this.ready($.proxy(this.play, this));
}
+ }
};
FlareVideo.fn.toggleFullScreen = function(){

0 comments on commit 3158424

Please sign in to comment.