Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support gecko mozRequestFullScreen api. #18

Merged
merged 1 commit into from Sep 9, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions javascripts/flarevideo.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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(){
Expand Down