]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix HTTP fallback with no webtorrent files
authorChocobozzz <me@florianbigard.com>
Mon, 12 Jul 2021 12:35:17 +0000 (14:35 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 12 Jul 2021 12:35:17 +0000 (14:35 +0200)
client/src/assets/player/peertube-player-manager.ts

index 81425318814dffebe956a06a305588e1479e6f17..ba0a6ab801f455878a8e2831dcac97d5083e889d 100644 (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
     }