]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix http player defaulting to audio resolution
authorChocobozzz <me@florianbigard.com>
Fri, 14 May 2021 11:58:40 +0000 (13:58 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 14 May 2021 11:58:40 +0000 (13:58 +0200)
client/src/assets/player/webtorrent/webtorrent-plugin.ts

index 6f5fbe4c97bfd404c581d512bcce7567c9d3f93a..e27a163909375ebde924999737deb1c28e96ab61 100644 (file)
@@ -557,7 +557,8 @@ class WebTorrentPlugin extends Plugin {
   private pickAverageVideoFile () {
     if (this.videoFiles.length === 1) return this.videoFiles[0]
 
-    return this.videoFiles[Math.floor(this.videoFiles.length / 2)]
+    const files = this.videoFiles.filter(f => f.resolution.id !== 0)
+    return files[Math.floor(files.length / 2)]
   }
 
   private stopTorrent (torrent: WebTorrent.Torrent) {