Fix HTTP fallback with no webtorrent files

This commit is contained in:
Chocobozzz 2021-07-12 14:35:17 +02:00
parent e89cbbdf94
commit 3e9cf56480
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 6 additions and 1 deletions

View File

@ -388,6 +388,7 @@ export class PeertubePlayerManager {
private static addWebTorrentOptions (plugins: VideoJSPluginOptions, options: PeertubePlayerManagerOptions) {
const commonOptions = options.common
const webtorrentOptions = options.webtorrent
const p2pMediaLoaderOptions = options.p2pMediaLoader
const autoplay = this.getAutoPlayValue(commonOptions.autoplay) === 'play'
? true
@ -397,7 +398,11 @@ export class PeertubePlayerManager {
autoplay,
videoDuration: commonOptions.videoDuration,
playerElement: commonOptions.playerElement,
videoFiles: webtorrentOptions.videoFiles,
videoFiles: webtorrentOptions.videoFiles.length !== 0
? webtorrentOptions.videoFiles
// The WebTorrent plugin won't be able to play these files, but it will fallback to HTTP mode
: p2pMediaLoaderOptions.videoFiles,
fallbackVideoFiles: p2pMediaLoaderOptions.videoFiles,
startTime: commonOptions.startTime
}