diff options
Diffstat (limited to 'client/src/assets/player/resolution-menu-item.ts')
-rw-r--r-- | client/src/assets/player/resolution-menu-item.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/client/src/assets/player/resolution-menu-item.ts b/client/src/assets/player/resolution-menu-item.ts index 8ad834c59..4b1ed0642 100644 --- a/client/src/assets/player/resolution-menu-item.ts +++ b/client/src/assets/player/resolution-menu-item.ts | |||
@@ -14,17 +14,38 @@ class ResolutionMenuItem extends MenuItem { | |||
14 | this.id = options.id | 14 | this.id = options.id |
15 | 15 | ||
16 | player.peertube().on('videoFileUpdate', () => this.updateSelection()) | 16 | player.peertube().on('videoFileUpdate', () => this.updateSelection()) |
17 | player.peertube().on('autoResolutionUpdate', () => this.updateSelection()) | ||
17 | } | 18 | } |
18 | 19 | ||
19 | handleClick (event) { | 20 | handleClick (event) { |
20 | super.handleClick(event) | 21 | super.handleClick(event) |
21 | 22 | ||
23 | // Auto resolution | ||
24 | if (this.id === -1) { | ||
25 | this.player_.peertube().enableAutoResolution() | ||
26 | return | ||
27 | } | ||
28 | |||
29 | this.player_.peertube().disableAutoResolution() | ||
22 | this.player_.peertube().updateResolution(this.id) | 30 | this.player_.peertube().updateResolution(this.id) |
23 | } | 31 | } |
24 | 32 | ||
25 | updateSelection () { | 33 | updateSelection () { |
34 | if (this.player_.peertube().isAutoResolutionOn()) { | ||
35 | this.selected(this.id === -1) | ||
36 | return | ||
37 | } | ||
38 | |||
26 | this.selected(this.player_.peertube().getCurrentResolutionId() === this.id) | 39 | this.selected(this.player_.peertube().getCurrentResolutionId() === this.id) |
27 | } | 40 | } |
41 | |||
42 | getLabel () { | ||
43 | if (this.id === -1) { | ||
44 | return this.label + ' <small>' + this.player_.peertube().getCurrentResolutionLabel() + '</small>' | ||
45 | } | ||
46 | |||
47 | return this.label | ||
48 | } | ||
28 | } | 49 | } |
29 | MenuItem.registerComponent('ResolutionMenuItem', ResolutionMenuItem) | 50 | MenuItem.registerComponent('ResolutionMenuItem', ResolutionMenuItem) |
30 | 51 | ||