aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/resolution-menu-item.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-11 11:52:34 +0100
committerChocobozzz <me@florianbigard.com>2019-02-11 11:52:34 +0100
commit88108880bbdba473cfe36ecbebc1c3c4f972e102 (patch)
treeb242efb3b4f0d7e49d88f2d1f2063b5b3b0489c0 /client/src/assets/player/resolution-menu-item.ts
parent53a94c7cfa8368da4cd248d65df8346905938f0c (diff)
parent9b712a2017e4ab3cf12cd6bd58278905520159d0 (diff)
downloadPeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.gz
PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.zst
PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.zip
Merge branch 'develop' into pr/1217
Diffstat (limited to 'client/src/assets/player/resolution-menu-item.ts')
-rw-r--r--client/src/assets/player/resolution-menu-item.ts64
1 files changed, 0 insertions, 64 deletions
diff --git a/client/src/assets/player/resolution-menu-item.ts b/client/src/assets/player/resolution-menu-item.ts
deleted file mode 100644
index 0ab0f53b5..000000000
--- a/client/src/assets/player/resolution-menu-item.ts
+++ /dev/null
@@ -1,64 +0,0 @@
1import * as videojs from 'video.js'
2import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
3
4const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
5class ResolutionMenuItem extends MenuItem {
6
7 constructor (player: videojs.Player, options) {
8 const currentResolutionId = player.peertube().getCurrentResolutionId()
9 options.selectable = true
10 options.selected = options.id === currentResolutionId
11
12 super(player, options)
13
14 this.label = options.label
15 this.id = options.id
16
17 player.peertube().on('videoFileUpdate', () => this.updateSelection())
18 player.peertube().on('autoResolutionUpdate', () => this.updateSelection())
19 }
20
21 handleClick (event) {
22 if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
23
24 super.handleClick(event)
25
26 // Auto resolution
27 if (this.id === -1) {
28 this.player_.peertube().enableAutoResolution()
29 return
30 }
31
32 this.player_.peertube().disableAutoResolution()
33 this.player_.peertube().updateResolution(this.id)
34 }
35
36 updateSelection () {
37 // Check if auto resolution is forbidden or not
38 if (this.id === -1) {
39 if (this.player_.peertube().isAutoResolutionForbidden()) {
40 this.addClass('disabled')
41 } else {
42 this.removeClass('disabled')
43 }
44 }
45
46 if (this.player_.peertube().isAutoResolutionOn()) {
47 this.selected(this.id === -1)
48 return
49 }
50
51 this.selected(this.player_.peertube().getCurrentResolutionId() === this.id)
52 }
53
54 getLabel () {
55 if (this.id === -1) {
56 return this.label + ' <small>' + this.player_.peertube().getCurrentResolutionLabel() + '</small>'
57 }
58
59 return this.label
60 }
61}
62MenuItem.registerComponent('ResolutionMenuItem', ResolutionMenuItem)
63
64export { ResolutionMenuItem }