Focus player on video loading
authorChocobozzz <me@florianbigard.com>
Thu, 28 Nov 2019 10:06:02 +0000 (11:06 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 28 Nov 2019 10:08:04 +0000 (11:08 +0100)
client/src/app/videos/+video-watch/video-watch.component.ts
client/src/assets/player/videojs-components/settings-menu-item.ts

index c78f5b9a2291cc318649047dbd132e91944cce46..80aa8ebe47685be3ded7bd7a41524a493585b0bc 100644 (file)
@@ -477,6 +477,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
 
     this.zone.runOutsideAngular(async () => {
       this.player = await PeertubePlayerManager.initialize(mode, options, player => this.player = player)
+      this.player.focus()
 
       this.player.on('customError', ({ err }: { err: any }) => this.handleError(err))
 
index 85172a18c086664598a8c6eeefd76570f2f58ed7..84d394c0ea46afed9d65a966bc180f20a57664d9 100644 (file)
@@ -329,6 +329,8 @@ class SettingsMenuItem extends MenuItem {
   }
 
   setMargin () {
+    if (!this.size) return
+
     const [ width ] = this.size
 
     this.settingsSubMenuEl_.style.marginRight = `-${width}px`