diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-05 16:15:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-05 16:15:51 +0200 |
commit | a8462c8e3a61f4f7314fe18c0c10cc2946c254d1 (patch) | |
tree | b5330cf0a8c313277f83263724c2a70b2f246c0f /client/src/assets/player/resolution-menu-button.ts | |
parent | 3d3441d6c7a5646388ab0a77acad57fdb63b9d32 (diff) | |
download | PeerTube-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-button.ts')
-rw-r--r-- | client/src/assets/player/resolution-menu-button.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/client/src/assets/player/resolution-menu-button.ts b/client/src/assets/player/resolution-menu-button.ts index 712e71192..2efc8de69 100644 --- a/client/src/assets/player/resolution-menu-button.ts +++ b/client/src/assets/player/resolution-menu-button.ts | |||
@@ -22,7 +22,7 @@ class ResolutionMenuButton extends MenuButton { | |||
22 | 22 | ||
23 | this.labelEl_ = videojsUntyped.dom.createEl('div', { | 23 | this.labelEl_ = videojsUntyped.dom.createEl('div', { |
24 | className: 'vjs-resolution-value', | 24 | className: 'vjs-resolution-value', |
25 | innerHTML: this.player_.peertube().getCurrentResolutionLabel() | 25 | innerHTML: this.buildLabelHTML() |
26 | }) | 26 | }) |
27 | 27 | ||
28 | el.appendChild(this.labelEl_) | 28 | el.appendChild(this.labelEl_) |
@@ -47,13 +47,22 @@ class ResolutionMenuButton extends MenuButton { | |||
47 | ) | 47 | ) |
48 | } | 48 | } |
49 | 49 | ||
50 | menu.addChild(new ResolutionMenuItem( | ||
51 | this.player_, | ||
52 | { | ||
53 | id: -1, | ||
54 | label: 'Auto', | ||
55 | src: null | ||
56 | } | ||
57 | )) | ||
58 | |||
50 | return menu | 59 | return menu |
51 | } | 60 | } |
52 | 61 | ||
53 | updateLabel () { | 62 | updateLabel () { |
54 | if (!this.labelEl_) return | 63 | if (!this.labelEl_) return |
55 | 64 | ||
56 | this.labelEl_.innerHTML = this.player_.peertube().getCurrentResolutionLabel() | 65 | this.labelEl_.innerHTML = this.buildLabelHTML() |
57 | } | 66 | } |
58 | 67 | ||
59 | buildCSSClass () { | 68 | buildCSSClass () { |
@@ -63,5 +72,9 @@ class ResolutionMenuButton extends MenuButton { | |||
63 | buildWrapperCSSClass () { | 72 | buildWrapperCSSClass () { |
64 | return 'vjs-resolution-control ' + super.buildWrapperCSSClass() | 73 | return 'vjs-resolution-control ' + super.buildWrapperCSSClass() |
65 | } | 74 | } |
75 | |||
76 | private buildLabelHTML () { | ||
77 | return this.player_.peertube().getCurrentResolutionLabel() | ||
78 | } | ||
66 | } | 79 | } |
67 | MenuButton.registerComponent('ResolutionMenuButton', ResolutionMenuButton) | 80 | MenuButton.registerComponent('ResolutionMenuButton', ResolutionMenuButton) |