Skip to content

Commit

Permalink
fix for chrome's <iframe> problem
Browse files Browse the repository at this point in the history
  • Loading branch information
johndyer committed Jan 11, 2012
1 parent 10a3de3 commit 5ded2cf
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 14 deletions.
24 changes: 23 additions & 1 deletion build/mediaelement-and-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions build/mediaelement-and-player.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/mediaelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion build/mediaelement.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions build/mediaelementplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 5ded2cf

Please sign in to comment.