diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-30 10:54:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-07-30 10:54:14 +0200 |
commit | 85394ba22a07bde1dfccebf3f591a5d6dbe9df56 (patch) | |
tree | 629ca49244824b7ec922628af009034edce2ff6a /client/src/assets/player | |
parent | df9a1a13654a1ca5229e8e940c25bae94af1717b (diff) | |
download | PeerTube-85394ba22a07bde1dfccebf3f591a5d6dbe9df56.tar.gz PeerTube-85394ba22a07bde1dfccebf3f591a5d6dbe9df56.tar.zst PeerTube-85394ba22a07bde1dfccebf3f591a5d6dbe9df56.zip |
Fix webtorrent player
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/webtorrent/video-renderer.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/webtorrent/webtorrent-plugin.ts | 9 |
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 => { |