]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Focus player after fullscreen
authorChocobozzz <me@florianbigard.com>
Thu, 9 Dec 2021 08:41:26 +0000 (09:41 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 9 Dec 2021 08:41:26 +0000 (09:41 +0100)
client/src/assets/player/peertube-plugin.ts

index 0121e87d72e18deb889b94aaf0408f02a3b0dc1f..f03553184df631617430fbba6289326830433c55 100644 (file)
@@ -126,6 +126,8 @@ class PeerTubePlugin extends Plugin {
     this.initCaptions()
 
     this.listenControlBarMouse()
+
+    this.listenFullScreenChange()
   }
 
   private runViewAdd () {
@@ -198,6 +200,12 @@ class PeerTubePlugin extends Plugin {
     return fetch(url, { method: 'PUT', body, headers })
   }
 
+  private listenFullScreenChange () {
+    this.player.on('fullscreenchange', () => {
+      if (this.player.isFullscreen()) this.player.focus()
+    })
+  }
+
   private listenControlBarMouse () {
     this.player.controlBar.on('mouseenter', () => {
       this.mouseInControlBar = true