]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/resolution-menu-item.ts
Fix transcoding
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / resolution-menu-item.ts
index 4b1ed0642b8cfa8a938c8b4242273412482143e2..afe490abbfe6ede93fedc33843229d219ed5c8a1 100644 (file)
@@ -3,7 +3,7 @@ import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-ty
 const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
 class ResolutionMenuItem extends MenuItem {
 
-  constructor (player: videojs.Player, options) {
+  constructor (player: any, options: any) {
     const currentResolutionId = player.peertube().getCurrentResolutionId()
     options.selectable = true
     options.selected = options.id === currentResolutionId
@@ -17,7 +17,9 @@ class ResolutionMenuItem extends MenuItem {
     player.peertube().on('autoResolutionUpdate', () => this.updateSelection())
   }
 
-  handleClick (event) {
+  handleClick (event: any) {
+    if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
+
     super.handleClick(event)
 
     // Auto resolution
@@ -31,6 +33,15 @@ class ResolutionMenuItem extends MenuItem {
   }
 
   updateSelection () {
+    // Check if auto resolution is forbidden or not
+    if (this.id === -1) {
+      if (this.player_.peertube().isAutoResolutionForbidden()) {
+        this.addClass('disabled')
+      } else {
+        this.removeClass('disabled')
+      }
+    }
+
     if (this.player_.peertube().isAutoResolutionOn()) {
       this.selected(this.id === -1)
       return