aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/fullscreen.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2019-03-16 12:14:20 +1100
committerSam Potts <sam@potts.es>2019-03-16 12:14:20 +1100
commit35f7ee9c59ff082a5b71aae43ffccab4cdf10fdf (patch)
tree75b8f7c56ec7fa6696991e52197172c9c6c7c3cd /src/js/fullscreen.js
parentbdd513635fffa33f66735c80209e6ae77e0426b4 (diff)
parentc202551e6d0b11656a99b41f3f8b3a48f2bf1e0a (diff)
downloadplyr-35f7ee9c59ff082a5b71aae43ffccab4cdf10fdf.tar.lz
plyr-35f7ee9c59ff082a5b71aae43ffccab4cdf10fdf.tar.xz
plyr-35f7ee9c59ff082a5b71aae43ffccab4cdf10fdf.zip
Merge branch 'develop' into css-variables
# Conflicts: # demo/dist/demo.css # demo/index.html # dist/plyr.css # gulpfile.js # package.json # yarn.lock
Diffstat (limited to 'src/js/fullscreen.js')
-rw-r--r--src/js/fullscreen.js26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/js/fullscreen.js b/src/js/fullscreen.js
index 9c21b82a..c86bf877 100644
--- a/src/js/fullscreen.js
+++ b/src/js/fullscreen.js
@@ -94,6 +94,9 @@ class Fullscreen {
// Scroll position
this.scrollPosition = { x: 0, y: 0 };
+ // Force the use of 'full window/browser' rather than fullscreen
+ this.forceFallback = player.config.fullscreen.fallback === 'force';
+
// Register event listeners
// Handle event (incase user presses escape etc)
on.call(
@@ -130,6 +133,11 @@ class Fullscreen {
);
}
+ // If we're actually using native
+ get usingNative() {
+ return Fullscreen.native && !this.forceFallback;
+ }
+
// Get the prefix for handlers
static get prefix() {
// No prefix
@@ -174,7 +182,7 @@ class Fullscreen {
}
// Fallback using classname
- if (!Fullscreen.native) {
+ if (!Fullscreen.native || this.forceFallback) {
return hasClass(this.target, this.player.config.classNames.fullscreen.fallback);
}
@@ -193,7 +201,17 @@ class Fullscreen {
// Update UI
update() {
if (this.enabled) {
- this.player.debug.log(`${Fullscreen.native ? 'Native' : 'Fallback'} fullscreen enabled`);
+ let mode;
+
+ if (this.forceFallback) {
+ mode = 'Fallback (forced)';
+ } else if (Fullscreen.native) {
+ mode = 'Native';
+ } else {
+ mode = 'Fallback';
+ }
+
+ this.player.debug.log(`${mode} fullscreen enabled`);
} else {
this.player.debug.log('Fullscreen not supported and fallback disabled');
}
@@ -211,7 +229,7 @@ class Fullscreen {
// iOS native fullscreen doesn't need the request step
if (browser.isIos && this.player.config.fullscreen.iosNative) {
this.target.webkitEnterFullscreen();
- } else if (!Fullscreen.native) {
+ } else if (!Fullscreen.native || this.forceFallback) {
toggleFallback.call(this, true);
} else if (!this.prefix) {
this.target.requestFullscreen();
@@ -230,7 +248,7 @@ class Fullscreen {
if (browser.isIos && this.player.config.fullscreen.iosNative) {
this.target.webkitExitFullscreen();
this.player.play();
- } else if (!Fullscreen.native) {
+ } else if (!Fullscreen.native || this.forceFallback) {
toggleFallback.call(this, false);
} else if (!this.prefix) {
(document.cancelFullScreen || document.exitFullscreen).call(document);