aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/ui.js
diff options
context:
space:
mode:
authorJames <james@hale.com.au>2018-10-23 10:08:46 +1100
committerJames <james@hale.com.au>2018-10-23 10:08:46 +1100
commit69d0d6d7eec8729da952aeea497db8f747a0ddfb (patch)
tree85491ce1fe9e8a93c41d6aaa86ccd40340ec289c /src/js/ui.js
parentfac134dd955fe1a264a68897cd49d06a5afd9750 (diff)
downloadplyr-69d0d6d7eec8729da952aeea497db8f747a0ddfb.tar.lz
plyr-69d0d6d7eec8729da952aeea497db8f747a0ddfb.tar.xz
plyr-69d0d6d7eec8729da952aeea497db8f747a0ddfb.zip
Prevent immediate hiding of controls on mobile
Diffstat (limited to 'src/js/ui.js')
-rw-r--r--src/js/ui.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/js/ui.js b/src/js/ui.js
index f0c898bf..8e50bb83 100644
--- a/src/js/ui.js
+++ b/src/js/ui.js
@@ -247,8 +247,11 @@ const ui = {
const { controls } = this.elements;
if (controls && this.config.hideControls) {
- // Show controls if force, loading, paused, or button interaction, otherwise hide
- this.toggleControls(Boolean(force || this.loading || this.paused || controls.pressed || controls.hover));
+ // Don't hide controls if a touch-device user recently seeked. (Must be limited to touch devices, or it occasionally prevents desktop controls from hiding.)
+ const recentTouchSeek = (this.touch && this.lastSeekTime + 2000 > Date.now());
+
+ // Show controls if force, loading, paused, button interaction, or recent seek, otherwise hide
+ this.toggleControls(Boolean(force || this.loading || this.paused || controls.pressed || controls.hover || recentTouchSeek));
}
},
};