}
// Do not display error to user because we will have multiple fallback
- this.disableErrorDisplay()
+ this.disableErrorDisplay();
// Hack to "simulate" src link in video.js >= 6
// Without this, we can't play the video after pausing it
options: PlayOptions,
done: Function
) {
+ if (!magnetOrTorrentUrl) return this.fallbackToHttp(options, done)
+
console.log('Adding ' + magnetOrTorrentUrl + '.')
const oldTorrent = this.torrent
uploadSpeed: this.torrent.uploadSpeed,
downloaded: this.torrent.downloaded,
uploaded: this.torrent.uploaded
- }
+ },
+ bandwidthEstimate: this.webtorrent.downloadSpeed
} as PlayerNetworkInfo)
}, this.CONSTANTS.INFO_SCHEDULER)
}
private pickAverageVideoFile () {
if (this.videoFiles.length === 1) return this.videoFiles[0]
- return this.videoFiles[Math.floor(this.videoFiles.length / 2)]
+ const files = this.videoFiles.filter(f => f.resolution.id !== 0)
+ return files[Math.floor(files.length / 2)]
}
private stopTorrent (torrent: WebTorrent.Torrent) {
}
private changeQuality () {
- const resolutionId = this.currentVideoFile.resolution.id
+ const resolutionId = this.currentVideoFile.resolution.id as number
const qualityLevels = this.player.qualityLevels()
if (resolutionId === -1) {