diff options
author | Sam <me@sampotts.me> | 2016-10-24 00:11:47 +1100 |
---|---|---|
committer | Sam <me@sampotts.me> | 2016-10-24 00:11:47 +1100 |
commit | c7310c21fbc3634c375c5dab72de55d12fc64df9 (patch) | |
tree | 5a67f83a51d725ed053eac4d9e7f4761b687d683 /src/js/plyr.js | |
parent | ed9e27b64f516a675d35c4bc4fbc6c5a2f9343da (diff) | |
download | plyr-c7310c21fbc3634c375c5dab72de55d12fc64df9.tar.lz plyr-c7310c21fbc3634c375c5dab72de55d12fc64df9.tar.xz plyr-c7310c21fbc3634c375c5dab72de55d12fc64df9.zip |
Fullscreen fix, styling
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r-- | src/js/plyr.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 36b99fd2..e21c5ab7 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -581,22 +581,25 @@ (function() { // Determine the prefix var prefix = (function() { - if (!_is.undefined(document.cancelFullScreen)) { - return ''; + var value = false; + + if (_is.function(document.cancelFullScreen)) { + value = ''; } else { // Check for fullscreen support by vendor prefix - ['webkit', 'o', 'moz', 'ms', 'khtml'].forEach(function(prefix) { - if (!_is.undefined(document[prefix + 'CancelFullScreen'])) { - return prefix; - } else if (!_is.undefined(document.msExitFullscreen) && document.msFullscreenEnabled) { + ['webkit', 'o', 'moz', 'ms', 'khtml'].some(function(prefix) { + if (_is.function(document[prefix + 'CancelFullScreen'])) { + value = prefix; + return true; + } else if (_is.function(document.msExitFullscreen) && document.msFullscreenEnabled) { // Special case for MS (when isn't it?) - return 'ms'; + value = 'ms'; + return true; } }); } - // If we got this far, there's no support - return false; + return value; })(); _fullscreen = { @@ -625,9 +628,12 @@ if (!_support.fullscreen) { return false; } - if (_is.undefined(element)) { + if (!_is.htmlElement(element)) { element = document.body; } + + console.log(prefix); + return (prefix === '') ? element.requestFullScreen() : element[prefix + (prefix === 'ms' ? 'RequestFullscreen' : 'RequestFullScreen')](); }, cancelFullScreen: function() { @@ -988,7 +994,6 @@ } // Picture in picture button - console.log(_support.pip); if (_inArray(config.controls, 'pip') && _support.pip) { html.push( '<button type="button" data-plyr="pip">', @@ -3315,7 +3320,7 @@ _on(plyr.buttons.pip, 'click', function() { //if () - plyr.media.webkitSetPresentationMode(plyr.media.webkitPresentationMode === 'optimized' ? 'inline' : 'optimized'); + plyr.media.webkitSetPresentationMode(plyr.media.webkitPresentationMode === 'picture-in-picture' ? 'inline' : 'picture-in-picture'); }); // Seek tooltip |