aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/resolution-menu-item.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-05 16:15:51 +0200
committerChocobozzz <me@florianbigard.com>2018-04-05 16:15:51 +0200
commita8462c8e3a61f4f7314fe18c0c10cc2946c254d1 (patch)
treeb5330cf0a8c313277f83263724c2a70b2f246c0f /client/src/assets/player/resolution-menu-item.ts
parent3d3441d6c7a5646388ab0a77acad57fdb63b9d32 (diff)
downloadPeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.tar.gz
PeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.tar.zst
PeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.zip
Automatic resolution according to user bandwidth V1
Diffstat (limited to 'client/src/assets/player/resolution-menu-item.ts')
-rw-r--r--client/src/assets/player/resolution-menu-item.ts21
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}
29MenuItem.registerComponent('ResolutionMenuItem', ResolutionMenuItem) 50MenuItem.registerComponent('ResolutionMenuItem', ResolutionMenuItem)
30 51