]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/webtorrent/webtorrent-plugin.ts
Hide schedule privacy if private does not exist
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / webtorrent / webtorrent-plugin.ts
index 6f5fbe4c97bfd404c581d512bcce7567c9d3f93a..b648b29e8105eb73a39484c2d0c7d61dd2239eb6 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) {
@@ -648,7 +649,7 @@ class WebTorrentPlugin extends Plugin {
   }
 
   private changeQuality () {
-    const resolutionId = this.currentVideoFile.resolution.id
+    const resolutionId = this.currentVideoFile.resolution.id as number
     const qualityLevels = this.player.qualityLevels()
 
     if (resolutionId === -1) {