aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/js/listeners.js3
-rw-r--r--src/js/plyr.js3
-rw-r--r--src/js/ui.js7
3 files changed, 11 insertions, 2 deletions
diff --git a/src/js/listeners.js b/src/js/listeners.js
index 31d74af6..63100365 100644
--- a/src/js/listeners.js
+++ b/src/js/listeners.js
@@ -620,6 +620,9 @@ class Listeners {
return;
}
+ // Record seek time so we can prevent hiding controls for a few seconds after seek
+ player.lastSeekTime = Date.now();
+
// Was playing before?
const play = seek.hasAttribute(attribute);
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 77582dd7..ebc0b733 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -302,6 +302,9 @@ class Plyr {
if (this.config.autoplay) {
this.play();
}
+
+ // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek
+ this.lastSeekTime = 0;
}
// ---------------------------------------
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));
}
},
};