]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/playlist/playlist-menu.ts
Fix console error when watching a video
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / playlist / playlist-menu.ts
index 7d7d9e12f11cb996b1cddaed4be2f0f1b236e2e2..a2583047ba6ffb0566b9ef90c60efc7d28fa41cb 100644 (file)
@@ -11,8 +11,18 @@ class PlaylistMenu extends Component {
   constructor (player: videojs.Player, options?: PlaylistPluginOptions) {
     super(player, options as any)
 
-    this.player().on('userinactive', () => {
-      this.close()
+    const self = this
+
+    function userInactiveHandler () {
+      self.close()
+    }
+
+    this.el().addEventListener('mouseenter', () => {
+      this.player().off('userinactive', userInactiveHandler)
+    })
+
+    this.el().addEventListener('mouseleave', () => {
+      this.player().one('userinactive', userInactiveHandler)
     })
 
     this.player().on('click', event => {
@@ -55,8 +65,11 @@ class PlaylistMenu extends Component {
       className: 'title'
     })
 
+    const playlistChannel = options.playlist.videoChannel
     const leftSubtitle = super.createEl('div', {
-      innerHTML: this.player().localize('By {1}', [ options.playlist.videoChannel.displayName ]),
+      innerHTML: playlistChannel
+        ? this.player().localize('By {1}', [ playlistChannel.displayName ])
+        : '',
       className: 'channel'
     })