Fix auto quality
authorChocobozzz <me@florianbigard.com>
Fri, 20 Apr 2018 08:21:28 +0000 (10:21 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 20 Apr 2018 08:21:28 +0000 (10:21 +0200)
client/src/assets/player/peertube-videojs-plugin.ts
client/src/sass/video-js-custom.scss

index 290d88724f063bbd914b783332f56f54ca5d3a69..a4f99559c3bcac7d6d3c8be447ff8aa47896c97c 100644 (file)
@@ -284,9 +284,11 @@ class PeerTubePlugin extends Plugin {
   private getAppropriateFile (averageDownloadSpeed?: number): VideoFile {
     if (this.videoFiles === undefined || this.videoFiles.length === 0) return undefined
     if (this.videoFiles.length === 1) return this.videoFiles[0]
-    if (this.torrent && this.torrent.progress === 1) return this.currentVideoFile
 
-    if (!averageDownloadSpeed) averageDownloadSpeed = this.getActualDownloadSpeed()
+    // Don't change the torrent is the play was ended
+    if (this.torrent && this.torrent.progress === 1 && this.player.ended()) return this.currentVideoFile
+
+    if (!averageDownloadSpeed) averageDownloadSpeed = this.getAndSaveActualDownloadSpeed()
 
     // Filter videos we can play according to our bandwidth
     const filteredFiles = this.videoFiles.filter(f => {
@@ -307,7 +309,7 @@ class PeerTubePlugin extends Plugin {
     return maxBy(filteredFiles, 'resolution.id')
   }
 
-  private getActualDownloadSpeed () {
+  private getAndSaveActualDownloadSpeed () {
     const start = Math.max(this.downloadSpeeds.length - this.CONSTANTS.BANDWIDTH_AVERAGE_NUMBER_OF_VALUES, 0)
     const lastDownloadSpeeds = this.downloadSpeeds.slice(start, this.downloadSpeeds.length)
     if (lastDownloadSpeeds.length === 0) return -1
index 88bc0cfdf7696d4991b8932ffa6e4a9d0faa9add..680958a9f8b0471785b3b2036d263bd094eab3ee 100644 (file)
@@ -447,7 +447,7 @@ $setting-transition-easing: ease-out;
     }
 
     .vjs-dock-description {
-      font-size: 10px;
+      font-size: 9px;
     }
 
     .vjs-big-play-button {
@@ -465,10 +465,6 @@ $setting-transition-easing: ease-out;
       font-size: 14px;
     }
 
-    .vjs-dock-description {
-      font-size: 9px;
-    }
-
     .vjs-big-play-button {
       font-size: 4.5em;
       border-width: 4.5px;