aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-22 15:06:33 +0200
committerChocobozzz <me@florianbigard.com>2018-06-22 15:11:04 +0200
commitc4082b8b4e3684baae0172e97297c936d7419f2c (patch)
tree226e2734b1d1945b25a69a661393c861cb933178 /client/src/assets/player
parent1a49822c321c34c39faf0411189a7073effa7eb7 (diff)
downloadPeerTube-c4082b8b4e3684baae0172e97297c936d7419f2c.tar.gz
PeerTube-c4082b8b4e3684baae0172e97297c936d7419f2c.tar.zst
PeerTube-c4082b8b4e3684baae0172e97297c936d7419f2c.zip
Disable auto resolution on HTTP fallback
Diffstat (limited to 'client/src/assets/player')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts13
-rw-r--r--client/src/assets/player/resolution-menu-button.ts1
-rw-r--r--client/src/assets/player/resolution-menu-item.ts11
3 files changed, 23 insertions, 2 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index fc07c35d6..208105d3c 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -57,6 +57,7 @@ class PeerTubePlugin extends Plugin {
57 private renderer 57 private renderer
58 private fakeRenderer 58 private fakeRenderer
59 private autoResolution = true 59 private autoResolution = true
60 private forbidAutoResolution = false
60 private isAutoResolutionObservation = false 61 private isAutoResolutionObservation = false
61 62
62 private videoViewInterval 63 private videoViewInterval
@@ -304,11 +305,17 @@ class PeerTubePlugin extends Plugin {
304 this.trigger('autoResolutionUpdate') 305 this.trigger('autoResolutionUpdate')
305 } 306 }
306 307
307 disableAutoResolution () { 308 disableAutoResolution (forbid = false) {
309 if (forbid === true) this.forbidAutoResolution = true
310
308 this.autoResolution = false 311 this.autoResolution = false
309 this.trigger('autoResolutionUpdate') 312 this.trigger('autoResolutionUpdate')
310 } 313 }
311 314
315 isAutoResolutionForbidden () {
316 return this.forbidAutoResolution === true
317 }
318
312 getCurrentVideoFile () { 319 getCurrentVideoFile () {
313 return this.currentVideoFile 320 return this.currentVideoFile
314 } 321 }
@@ -509,6 +516,8 @@ class PeerTubePlugin extends Plugin {
509 } 516 }
510 517
511 private fallbackToHttp (done?: Function, play = true) { 518 private fallbackToHttp (done?: Function, play = true) {
519 this.disableAutoResolution(true)
520
512 this.flushVideoFile(this.currentVideoFile, true) 521 this.flushVideoFile(this.currentVideoFile, true)
513 this.torrent = null 522 this.torrent = null
514 523
@@ -555,7 +564,7 @@ class PeerTubePlugin extends Plugin {
555 this.player.controlBar.on('mouseenter', () => disableInactivity()) 564 this.player.controlBar.on('mouseenter', () => disableInactivity())
556 settingsDialog.on('mouseenter', () => disableInactivity()) 565 settingsDialog.on('mouseenter', () => disableInactivity())
557 this.player.controlBar.on('mouseleave', () => enableInactivity()) 566 this.player.controlBar.on('mouseleave', () => enableInactivity())
558 settingsDialog.on('mouseleave', () => enableInactivity()) 567 // settingsDialog.on('mouseleave', () => enableInactivity())
559 } 568 }
560 569
561 private pickAverageVideoFile () { 570 private pickAverageVideoFile () {
diff --git a/client/src/assets/player/resolution-menu-button.ts b/client/src/assets/player/resolution-menu-button.ts
index d317a5efc..e30074173 100644
--- a/client/src/assets/player/resolution-menu-button.ts
+++ b/client/src/assets/player/resolution-menu-button.ts
@@ -12,6 +12,7 @@ class ResolutionMenuButton extends MenuButton {
12 this.player = player 12 this.player = player
13 13
14 player.peertube().on('videoFileUpdate', () => this.updateLabel()) 14 player.peertube().on('videoFileUpdate', () => this.updateLabel())
15 player.peertube().on('autoResolutionUpdate', () => this.updateLabel())
15 } 16 }
16 17
17 createEl () { 18 createEl () {
diff --git a/client/src/assets/player/resolution-menu-item.ts b/client/src/assets/player/resolution-menu-item.ts
index 3fe1d8f0f..0ab0f53b5 100644
--- a/client/src/assets/player/resolution-menu-item.ts
+++ b/client/src/assets/player/resolution-menu-item.ts
@@ -19,6 +19,8 @@ class ResolutionMenuItem extends MenuItem {
19 } 19 }
20 20
21 handleClick (event) { 21 handleClick (event) {
22 if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
23
22 super.handleClick(event) 24 super.handleClick(event)
23 25
24 // Auto resolution 26 // Auto resolution
@@ -32,6 +34,15 @@ class ResolutionMenuItem extends MenuItem {
32 } 34 }
33 35
34 updateSelection () { 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
35 if (this.player_.peertube().isAutoResolutionOn()) { 46 if (this.player_.peertube().isAutoResolutionOn()) {
36 this.selected(this.id === -1) 47 this.selected(this.id === -1)
37 return 48 return