ActivityPub-federated video streaming platform using P2P directly in your web browser
Pick average video file insead of max quality
Chocobozzz8eb8bc201e08
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.tsindex b54f096b26..e68d79e40e 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 {const savedAverageBandwidth = getAverageBandwidth()videoFile = savedAverageBandwidth? this.getAppropriateFile(savedAverageBandwidth)- : this.videoFiles[0]+ : this.pickAverageVideoFile()}// Don't add the same video file once again@@ -377,7 +377,7 @@ class PeerTubePlugin extends Plugin {} else {// Don't try on iOS that does not support MediaSourceif (this.isIOS()) {- this.currentVideoFile = this.videoFiles[0]+ this.currentVideoFile = this.pickAverageVideoFile()return this.fallbackToHttp(undefined, false)}@@ -533,6 +533,12 @@ class PeerTubePlugin extends Plugin {settingsDialog.on('mouseleave', () => enableInactivity())}+ private pickAverageVideoFile () {+ if (this.videoFiles.length === 1) return this.videoFiles[0]++ return this.videoFiles[Math.floor(this.videoFiles.length / 2)]+ }+// Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657private initSmoothProgressBar () {const SeekBar = videojsUntyped.getComponent('SeekBar')diff --git a/server/lib/job-queue/handlers/video-file.ts b/server/lib/job-queue/handlers/video-file.tsindex a6fce42790..85f7dbfc2b 100644--- a/server/lib/job-queue/handlers/video-file.ts+++ b/server/lib/job-queue/handlers/video-file.ts@@ -85,7 +85,7 @@ async function onVideoFileOptimizerSuccess (video: VideoModel, isNewVideo: booleif (!videoDatabase) return undefinedif (video.privacy !== VideoPrivacy.PRIVATE) {- if (isNewVideo === true) {+ if (isNewVideo !== false) {// Now we'll add the video's meta data to our followersawait sequelizeTypescript.transaction(async t => {await sendCreateVideo(video, t)