diff options
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 10 |
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') |