diff options
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 10 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-file.ts | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index b54f096b2..e68d79e40 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 { | |||
147 | const savedAverageBandwidth = getAverageBandwidth() | 147 | const savedAverageBandwidth = getAverageBandwidth() |
148 | videoFile = savedAverageBandwidth | 148 | videoFile = savedAverageBandwidth |
149 | ? this.getAppropriateFile(savedAverageBandwidth) | 149 | ? this.getAppropriateFile(savedAverageBandwidth) |
150 | : this.videoFiles[0] | 150 | : this.pickAverageVideoFile() |
151 | } | 151 | } |
152 | 152 | ||
153 | // Don't add the same video file once again | 153 | // Don't add the same video file once again |
@@ -377,7 +377,7 @@ class PeerTubePlugin extends Plugin { | |||
377 | } else { | 377 | } else { |
378 | // Don't try on iOS that does not support MediaSource | 378 | // Don't try on iOS that does not support MediaSource |
379 | if (this.isIOS()) { | 379 | if (this.isIOS()) { |
380 | this.currentVideoFile = this.videoFiles[0] | 380 | this.currentVideoFile = this.pickAverageVideoFile() |
381 | return this.fallbackToHttp(undefined, false) | 381 | return this.fallbackToHttp(undefined, false) |
382 | } | 382 | } |
383 | 383 | ||
@@ -533,6 +533,12 @@ class PeerTubePlugin extends Plugin { | |||
533 | settingsDialog.on('mouseleave', () => enableInactivity()) | 533 | settingsDialog.on('mouseleave', () => enableInactivity()) |
534 | } | 534 | } |
535 | 535 | ||
536 | private pickAverageVideoFile () { | ||
537 | if (this.videoFiles.length === 1) return this.videoFiles[0] | ||
538 | |||
539 | return this.videoFiles[Math.floor(this.videoFiles.length / 2)] | ||
540 | } | ||
541 | |||
536 | // Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657 | 542 | // Thanks: https://github.com/videojs/video.js/issues/4460#issuecomment-312861657 |
537 | private initSmoothProgressBar () { | 543 | private initSmoothProgressBar () { |
538 | const SeekBar = videojsUntyped.getComponent('SeekBar') | 544 | const SeekBar = videojsUntyped.getComponent('SeekBar') |
diff --git a/server/lib/job-queue/handlers/video-file.ts b/server/lib/job-queue/handlers/video-file.ts index a6fce4279..85f7dbfc2 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: boole | |||
85 | if (!videoDatabase) return undefined | 85 | if (!videoDatabase) return undefined |
86 | 86 | ||
87 | if (video.privacy !== VideoPrivacy.PRIVATE) { | 87 | if (video.privacy !== VideoPrivacy.PRIVATE) { |
88 | if (isNewVideo === true) { | 88 | if (isNewVideo !== false) { |
89 | // Now we'll add the video's meta data to our followers | 89 | // Now we'll add the video's meta data to our followers |
90 | await sequelizeTypescript.transaction(async t => { | 90 | await sequelizeTypescript.transaction(async t => { |
91 | await sendCreateVideo(video, t) | 91 | await sendCreateVideo(video, t) |