From 3e9cf56480101af06cdeae9dbae04fdcb4973a7f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 12 Jul 2021 14:35:17 +0200 Subject: [PATCH] Fix HTTP fallback with no webtorrent files --- client/src/assets/player/peertube-player-manager.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 814253188..ba0a6ab80 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts @@ -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 } -- 2.41.0