aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-09-10 15:43:15 +0200
committerChocobozzz <me@florianbigard.com>2021-09-10 15:53:33 +0200
commit89ac282e0437ae839e3d71566f25321f9b9384e9 (patch)
tree36c19effc7d10e727b4896c1958ba3542fb53a1d /client/src/assets
parent624e42fdf9456816f92000e632d01390f3b5c840 (diff)
downloadPeerTube-89ac282e0437ae839e3d71566f25321f9b9384e9.tar.gz
PeerTube-89ac282e0437ae839e3d71566f25321f9b9384e9.tar.zst
PeerTube-89ac282e0437ae839e3d71566f25321f9b9384e9.zip
Fix embed api
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/webtorrent/webtorrent-plugin.ts40
1 files changed, 20 insertions, 20 deletions
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts
index a464f02d5..1a1cd7f1a 100644
--- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts
+++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts
@@ -178,7 +178,7 @@ class WebTorrentPlugin extends Plugin {
178 this.selectAppropriateResolution(true) 178 this.selectAppropriateResolution(true)
179 } 179 }
180 180
181 updateResolution (resolutionId: number, delay = 0) { 181 updateEngineResolution (resolutionId: number, delay = 0) {
182 // Remember player state 182 // Remember player state
183 const currentTime = this.player.currentTime() 183 const currentTime = this.player.currentTime()
184 const isPaused = this.player.paused() 184 const isPaused = this.player.paused()
@@ -236,6 +236,22 @@ class WebTorrentPlugin extends Plugin {
236 return this.currentVideoFile 236 return this.currentVideoFile
237 } 237 }
238 238
239 changeQuality (id: number) {
240 if (id === -1) {
241 if (this.autoResolutionPossible === true) {
242 this.autoResolution = true
243
244 this.selectAppropriateResolution(false)
245 }
246
247 return
248 }
249
250 this.autoResolution = false
251 this.updateEngineResolution(id)
252 this.selectAppropriateResolution(false)
253 }
254
239 private addTorrent ( 255 private addTorrent (
240 magnetOrTorrentUrl: string, 256 magnetOrTorrentUrl: string,
241 previousVideoFile: VideoFile, 257 previousVideoFile: VideoFile,
@@ -458,7 +474,7 @@ class WebTorrentPlugin extends Plugin {
458 } 474 }
459 475
460 if (changeResolution === true) { 476 if (changeResolution === true) {
461 this.updateResolution(file.resolution.id, changeResolutionDelay) 477 this.updateEngineResolution(file.resolution.id, changeResolutionDelay)
462 478
463 // Wait some seconds in observation of our new resolution 479 // Wait some seconds in observation of our new resolution
464 this.isAutoResolutionObservation = true 480 this.isAutoResolutionObservation = true
@@ -598,14 +614,14 @@ class WebTorrentPlugin extends Plugin {
598 label: this.buildQualityLabel(file), 614 label: this.buildQualityLabel(file),
599 height: file.resolution.id, 615 height: file.resolution.id,
600 selected: false, 616 selected: false,
601 selectCallback: () => this.qualitySwitchCallback(file.resolution.id) 617 selectCallback: () => this.changeQuality(file.resolution.id)
602 })) 618 }))
603 619
604 resolutions.push({ 620 resolutions.push({
605 id: -1, 621 id: -1,
606 label: this.player.localize('Auto'), 622 label: this.player.localize('Auto'),
607 selected: true, 623 selected: true,
608 selectCallback: () => this.qualitySwitchCallback(-1) 624 selectCallback: () => this.changeQuality(-1)
609 }) 625 })
610 626
611 this.player.peertubeResolutions().add(resolutions) 627 this.player.peertubeResolutions().add(resolutions)
@@ -621,22 +637,6 @@ class WebTorrentPlugin extends Plugin {
621 return label 637 return label
622 } 638 }
623 639
624 private qualitySwitchCallback (id: number) {
625 if (id === -1) {
626 if (this.autoResolutionPossible === true) {
627 this.autoResolution = true
628
629 this.selectAppropriateResolution(false)
630 }
631
632 return
633 }
634
635 this.autoResolution = false
636 this.updateResolution(id)
637 this.selectAppropriateResolution(false)
638 }
639
640 private selectAppropriateResolution (byEngine: boolean) { 640 private selectAppropriateResolution (byEngine: boolean) {
641 const resolution = this.autoResolution 641 const resolution = this.autoResolution
642 ? -1 642 ? -1