Skip to content
Permalink
Browse files

Use HTML5 fullscreen API for plugin player when possible

  • Loading branch information...
Phuong Dinh
Phuong Dinh committed May 23, 2013
1 parent 10ef749 commit 5535639257303fef80c2d1300c43a3441971056d
Showing with 26 additions and 26 deletions.
  1. +26 −26 src/js/mep-feature-fullscreen.js
@@ -311,38 +311,36 @@
normalWidth = t.container.width();

// attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
if (t.media.pluginType === 'native') {
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {

mejs.MediaFeatures.requestFullScreen(t.container[0]);
//return;
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.isInIframe) {
// sometimes exiting from fullscreen doesn't work
// notably in Chrome <iframe>. Fixed in version 17
setTimeout(function checkFullscreen() {

if (t.isNativeFullScreen) {
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);
}
// 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;
}, 500);
}
}

} else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
t.media.webkitEnterFullscreen();
return;
}

// check for iframe launch
if (t.isInIframe) {
@@ -397,9 +395,11 @@
.width('100%')
.height('100%');

//if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
t.media.setVideoSize(screen.width,screen.height);
} else {
t.media.setVideoSize($(window).width(),$(window).height());
//}
}
}

t.layers.children('div')

0 comments on commit 5535639

Please sign in to comment.
You can’t perform that action at this time.