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 --- .../shared-user-subscription/remote-subscribe.component.ts | 2 -- client/src/assets/player/peertube-plugin.ts | 12 ++++++++++-- client/src/standalone/videos/embed.ts | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts index 09164a5d3..286ecac02 100644 --- a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts +++ b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.ts @@ -39,8 +39,6 @@ export class RemoteSubscribeComponent extends FormReactive implements OnInit { fetch(`https://${hostname}/.well-known/webfinger?resource=acct:${username}@${hostname}`) .then(response => response.json()) .then(data => new Promise((resolve, reject) => { - console.log(data) - if (data && Array.isArray(data.links)) { const link: { template: string } = data.links.find((link: any) => { return link && typeof link.template === 'string' && link.rel === 'http://ostatus.org/schema/1.0/subscribe' 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 () { diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index 286757e5e..86a91643a 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts @@ -201,7 +201,7 @@ export class PeerTubeEmbed { subtitle: this.subtitle, videoCaptions, - inactivityTimeout: 1500, + inactivityTimeout: 2500, videoViewUrl: this.getVideoUrl(videoId) + '/views', playerElement: this.videoElement, -- cgit v1.2.3