Permalink
Browse files

fix for chrome's <iframe> problem

  • Loading branch information...
1 parent 10a3de3 commit 5ded2cf40f90f585e6e73db1e5945dcf4cf66ff0 @johndyer johndyer committed Jan 11, 2012
@@ -15,7 +15,7 @@
var mejs = mejs || {};
// version number
-mejs.version = '2.6.4';
+mejs.version = '2.6.5';
// player number (for missing, same id attr)
mejs.meIndex = 0;
@@ -3066,6 +3066,7 @@ if (typeof jQuery != 'undefined') {
// native events
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
+ // chrome doesn't alays fire this in an iframe
player.container.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
//player.container.bind('webkitfullscreenchange', function(e) {
@@ -3300,6 +3301,27 @@ if (typeof jQuery != 'undefined') {
mejs.MediaFeatures.requestFullScreen(t.container[0]);
//return;
+ if (t.isInIframe) {
+ // sometimes exiting from fullscreen doesn't work
+ // notably in Chrome <iframe>. Fixed in version 17
+ setTimeout(function checkFullscreen() {
+
+ if (t.isNativeFullScreen) {
+
+ // check if the video is suddenly not really fullscreen
+ if ($(window).width() !== screen.width) {
+ // manually exit
+ t.exitFullScreen();
+ } else {
+ // test again
+ setTimeout(checkFullscreen, 500);
+ }
+ }
+
+
+ }, 500);
+ }
+
} else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
t.media.webkitEnterFullscreen();
return;

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -15,7 +15,7 @@
var mejs = mejs || {};
// version number
-mejs.version = '2.6.4';
+mejs.version = '2.6.5';
// player number (for missing, same id attr)
mejs.meIndex = 0;

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1581,6 +1581,7 @@ if (typeof jQuery != 'undefined') {
// native events
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
+ // chrome doesn't alays fire this in an iframe
player.container.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
//player.container.bind('webkitfullscreenchange', function(e) {
@@ -1815,6 +1816,27 @@ if (typeof jQuery != 'undefined') {
mejs.MediaFeatures.requestFullScreen(t.container[0]);
//return;
+ if (t.isInIframe) {
+ // sometimes exiting from fullscreen doesn't work
+ // notably in Chrome <iframe>. Fixed in version 17
+ setTimeout(function checkFullscreen() {
+
+ if (t.isNativeFullScreen) {
+
+ // check if the video is suddenly not really fullscreen
+ if ($(window).width() !== screen.width) {
+ // manually exit
+ t.exitFullScreen();
+ } else {
+ // test again
+ setTimeout(checkFullscreen, 500);
+ }
+ }
+
+
+ }, 500);
+ }
+
} else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
t.media.webkitEnterFullscreen();
return;
Oops, something went wrong.

0 comments on commit 5ded2cf

Please sign in to comment.