aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/assets/player/webtorrent/video-renderer.ts2
-rw-r--r--client/src/assets/player/webtorrent/webtorrent-plugin.ts9
2 files changed, 7 insertions, 4 deletions
diff --git a/client/src/assets/player/webtorrent/video-renderer.ts b/client/src/assets/player/webtorrent/video-renderer.ts
index 4dce87112..c3cbea725 100644
--- a/client/src/assets/player/webtorrent/video-renderer.ts
+++ b/client/src/assets/player/webtorrent/video-renderer.ts
@@ -51,7 +51,7 @@ function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOption
51 return callback(err) 51 return callback(err)
52 }) 52 })
53 preparedElem.addEventListener('loadstart', onLoadStart) 53 preparedElem.addEventListener('loadstart', onLoadStart)
54 return videostream(file, preparedElem) 54 return new videostream(file, preparedElem)
55 } 55 }
56 56
57 function useMediaSource (useVP9 = false) { 57 function useMediaSource (useVP9 = false) {
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts
index eee3d4db9..95f52dfe1 100644
--- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts
+++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts
@@ -234,9 +234,12 @@ class WebTorrentPlugin extends Plugin {
234 234
235 const oldTorrent = this.torrent 235 const oldTorrent = this.torrent
236 const torrentOptions = { 236 const torrentOptions = {
237 store: (chunkLength: number, storeOpts: any) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), { 237 // Don't use arrow function: it breaks webtorrent (that uses `new` keyword)
238 max: 100 238 store: function (chunkLength: number, storeOpts: any) {
239 }) 239 return new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), {
240 max: 100
241 })
242 }
240 } 243 }
241 244
242 this.torrent = this.webtorrent.add(magnetOrTorrentUrl, torrentOptions, torrent => { 245 this.torrent = this.webtorrent.add(magnetOrTorrentUrl, torrentOptions, torrent => {