aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/videojs-components/resolution-menu-item.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/videojs-components/resolution-menu-item.ts')
-rw-r--r--client/src/assets/player/videojs-components/resolution-menu-item.ts18
1 files changed, 7 insertions, 11 deletions
diff --git a/client/src/assets/player/videojs-components/resolution-menu-item.ts b/client/src/assets/player/videojs-components/resolution-menu-item.ts
index cc1c79739..6c42fefd2 100644
--- a/client/src/assets/player/videojs-components/resolution-menu-item.ts
+++ b/client/src/assets/player/videojs-components/resolution-menu-item.ts
@@ -28,16 +28,12 @@ class ResolutionMenuItem extends MenuItem {
28 this.id = options.id 28 this.id = options.id
29 this.callback = options.callback 29 this.callback = options.callback
30 30
31 if (player.webtorrent) { 31 player.peertube().on('resolutionChange', (_: any, data: ResolutionUpdateData) => this.updateSelection(data))
32 player.webtorrent().on('videoFileUpdate', (_: any, data: ResolutionUpdateData) => this.updateSelection(data))
33 32
34 // We only want to disable the "Auto" item 33 // We only want to disable the "Auto" item
35 if (this.id === -1) { 34 if (this.id === -1) {
36 player.webtorrent().on('autoResolutionUpdate', (_: any, data: AutoResolutionUpdateData) => this.updateAutoResolution(data)) 35 player.peertube().on('autoResolutionChange', (_: any, data: AutoResolutionUpdateData) => this.updateAutoResolution(data))
37 }
38 } 36 }
39
40 // TODO: update on HLS change
41 } 37 }
42 38
43 handleClick (event: any) { 39 handleClick (event: any) {
@@ -46,12 +42,12 @@ class ResolutionMenuItem extends MenuItem {
46 42
47 super.handleClick(event) 43 super.handleClick(event)
48 44
49 this.callback(this.id) 45 this.callback(this.id, 'video')
50 } 46 }
51 47
52 updateSelection (data: ResolutionUpdateData) { 48 updateSelection (data: ResolutionUpdateData) {
53 if (this.id === -1) { 49 if (this.id === -1) {
54 this.currentResolutionLabel = this.labels[data.resolutionId] 50 this.currentResolutionLabel = this.labels[data.id]
55 } 51 }
56 52
57 // Automatic resolution only 53 // Automatic resolution only
@@ -60,7 +56,7 @@ class ResolutionMenuItem extends MenuItem {
60 return 56 return
61 } 57 }
62 58
63 this.selected(this.id === data.resolutionId) 59 this.selected(this.id === data.id)
64 } 60 }
65 61
66 updateAutoResolution (data: AutoResolutionUpdateData) { 62 updateAutoResolution (data: AutoResolutionUpdateData) {