aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-07 17:51:25 +0200
committerChocobozzz <me@florianbigard.com>2018-06-07 17:57:11 +0200
commit8eb8bc201e0861599702a4048ff7edc59ad34d89 (patch)
tree04a89cb3dd58f44ce0eaac424633498cf07160b4 /client/src
parent54d9d09bb165d4b47ddc1c10ba81b41b04895911 (diff)
downloadPeerTube-8eb8bc201e0861599702a4048ff7edc59ad34d89.tar.gz
PeerTube-8eb8bc201e0861599702a4048ff7edc59ad34d89.tar.zst
PeerTube-8eb8bc201e0861599702a4048ff7edc59ad34d89.zip
Pick average video file insead of max quality
Diffstat (limited to 'client/src')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index b54f096b2..e68d79e40 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -147,7 +147,7 @@ class PeerTubePlugin extends Plugin {
147 const savedAverageBandwidth = getAverageBandwidth() 147 const savedAverageBandwidth = getAverageBandwidth()
148 videoFile = savedAverageBandwidth 148 videoFile = savedAverageBandwidth
149 ? this.getAppropriateFile(savedAverageBandwidth) 149 ? this.getAppropriateFile(savedAverageBandwidth)
150 : this.videoFiles[0] 150 : this.pickAverageVideoFile()
151 } 151 }
152 152
153 // Don't add the same video file once again 153 // Don't add the same video file once again
@@ -377,7 +377,7 @@ class PeerTubePlugin extends Plugin {
377 } else { 377 } else {
378 // Don't try on iOS that does not support MediaSource 378 // Don't try on iOS that does not support MediaSource
379 if (this.isIOS()) { 379 if (this.isIOS()) {
380 this.currentVideoFile = this.videoFiles[0] 380 this.currentVideoFile = this.pickAverageVideoFile()
381 return this.fallbackToHttp(undefined, false) 381 return this.fallbackToHttp(undefined, false)
382 } 382 }
383 383
@@ -533,6 +533,12 @@ class PeerTubePlugin extends Plugin {
533 settingsDialog.on('mouseleave', () => enableInactivity()) 533 settingsDialog.on('mouseleave', () => enableInactivity())
534 } 534 }
535 535
536 private pickAverageVideoFile () {
537 if (this.videoFiles.length === 1) return this.videoFiles[0]
538
539 return this.videoFiles[Math.floor(this.videoFiles.length / 2)]
540 }
541
536 // Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657 542 // Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657
537 private initSmoothProgressBar () { 543 private initSmoothProgressBar () {
538 const SeekBar = videojsUntyped.getComponent('SeekBar') 544 const SeekBar = videojsUntyped.getComponent('SeekBar')