From 35f0a5e665a565ffc9d4b88c5a12d45c88b0a090 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 2 Jul 2020 15:10:06 +0200 Subject: Fix player menu on mobile --- client/src/assets/player/peertube-plugin.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'client/src/assets/player/peertube-plugin.ts') diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/peertube-plugin.ts index a5a706420..a2b038b77 100644 --- a/client/src/assets/player/peertube-plugin.ts +++ b/client/src/assets/player/peertube-plugin.ts @@ -233,12 +233,20 @@ class PeerTubePlugin extends Plugin { } private alterInactivity () { - if (this.menuOpened || this.mouseInControlBar) { + if (this.menuOpened) { this.player.options_.inactivityTimeout = this.savedInactivityTimeout return } - this.player.options_.inactivityTimeout = 1 + if (!this.mouseInControlBar && !this.isTouchEnabled()) { + this.player.options_.inactivityTimeout = 1 + } + } + + private isTouchEnabled () { + return ('ontouchstart' in window) || + navigator.maxTouchPoints > 0 || + navigator.msMaxTouchPoints > 0 } private initCaptions () { -- cgit v1.2.3