filter to Cap the maximum resolution to the screen resolution
authorNitesh Sawant <ns23@github.com>
Sat, 30 Jun 2018 09:44:50 +0000 (15:14 +0530)
committerChocobozzz <me@florianbigard.com>
Sat, 30 Jun 2018 10:44:10 +0000 (12:44 +0200)
client/src/assets/player/peertube-videojs-plugin.ts

index e268510fa0ff74cfe6d561ee4106d790e5b82a13..32cc4cd8f1cd0cbb7fc8408983760f9aa5c12a6d 100644 (file)
@@ -365,8 +365,9 @@ class PeerTubePlugin extends Plugin {
 
     if (!averageDownloadSpeed) averageDownloadSpeed = this.getAndSaveActualDownloadSpeed()
 
-    // Filter videos we can play according to our bandwidth
-    const filteredFiles = this.videoFiles.filter(f => {
+    // Filter videos we can play according to our screen resolution and bandwidth
+    const filteredFiles = this.videoFiles.filter(f => f.resolution.id <= this.playerElement.width)
+    .filter(f => {
       const fileBitrate = (f.size / this.videoDuration)
       let threshold = fileBitrate