const savedAverageBandwidth = getAverageBandwidth()
videoFile = savedAverageBandwidth
? this.getAppropriateFile(savedAverageBandwidth)
- : this.videoFiles[0]
+ : this.pickAverageVideoFile()
}
// Don't add the same video file once again
} else {
// Don't try on iOS that does not support MediaSource
if (this.isIOS()) {
- this.currentVideoFile = this.videoFiles[0]
+ this.currentVideoFile = this.pickAverageVideoFile()
return this.fallbackToHttp(undefined, false)
}
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-312861657
private initSmoothProgressBar () {
const SeekBar = videojsUntyped.getComponent('SeekBar')
if (!videoDatabase) return undefined
if (video.privacy !== VideoPrivacy.PRIVATE) {
- if (isNewVideo === true) {
+ if (isNewVideo !== false) {
// Now we'll add the video's meta data to our followers
await sequelizeTypescript.transaction(async t => {
await sendCreateVideo(video, t)