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 | |
parent | df9a1a13654a1ca5229e8e940c25bae94af1717b (diff) | |
download | PeerTube-85394ba22a07bde1dfccebf3f591a5d6dbe9df56.tar.gz PeerTube-85394ba22a07bde1dfccebf3f591a5d6dbe9df56.tar.zst PeerTube-85394ba22a07bde1dfccebf3f591a5d6dbe9df56.zip |
Fix webtorrent player
Diffstat (limited to 'client')
-rw-r--r-- | client/package.json | 1 | ||||
-rw-r--r-- | client/src/assets/player/webtorrent/video-renderer.ts | 2 | ||||
-rw-r--r-- | client/src/assets/player/webtorrent/webtorrent-plugin.ts | 9 | ||||
-rw-r--r-- | client/yarn.lock | 36 |
4 files changed, 42 insertions, 6 deletions
diff --git a/client/package.json b/client/package.json index f770be5fe..5d733f1b8 100644 --- a/client/package.json +++ b/client/package.json | |||
@@ -125,6 +125,7 @@ | |||
125 | "videojs-contrib-quality-levels": "^2.0.9", | 125 | "videojs-contrib-quality-levels": "^2.0.9", |
126 | "videojs-dock": "^2.0.2", | 126 | "videojs-dock": "^2.0.2", |
127 | "videojs-hotkeys": "^0.2.21", | 127 | "videojs-hotkeys": "^0.2.21", |
128 | "videostream": "~3.1", | ||
128 | "webpack-bundle-analyzer": "^3.0.2", | 129 | "webpack-bundle-analyzer": "^3.0.2", |
129 | "webpack-cli": "^3.0.8", | 130 | "webpack-cli": "^3.0.8", |
130 | "webtorrent": "^0.105.1", | 131 | "webtorrent": "^0.105.1", |
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 => { |
diff --git a/client/yarn.lock b/client/yarn.lock index c93872a17..714e5c5cc 100644 --- a/client/yarn.lock +++ b/client/yarn.lock | |||
@@ -5779,7 +5779,7 @@ move-concurrently@^1.0.1: | |||
5779 | rimraf "^2.5.4" | 5779 | rimraf "^2.5.4" |
5780 | run-queue "^1.0.3" | 5780 | run-queue "^1.0.3" |
5781 | 5781 | ||
5782 | mp4-box-encoding@^1.3.0: | 5782 | mp4-box-encoding@^1.1.0, mp4-box-encoding@^1.3.0: |
5783 | version "1.3.0" | 5783 | version "1.3.0" |
5784 | resolved "https://registry.yarnpkg.com/mp4-box-encoding/-/mp4-box-encoding-1.3.0.tgz#2a6f750947ff68c3a498fd76cd6424c53d995d48" | 5784 | resolved "https://registry.yarnpkg.com/mp4-box-encoding/-/mp4-box-encoding-1.3.0.tgz#2a6f750947ff68c3a498fd76cd6424c53d995d48" |
5785 | integrity sha512-U4pMLpjT/UzB8d36dxj6Mf1bG9xypEvgbuRIa1fztRXNKKTCAtRxsnFZhNOd7YDFOKtjBgssYGvo4H/Q3ZY1MA== | 5785 | integrity sha512-U4pMLpjT/UzB8d36dxj6Mf1bG9xypEvgbuRIa1fztRXNKKTCAtRxsnFZhNOd7YDFOKtjBgssYGvo4H/Q3ZY1MA== |
@@ -5788,6 +5788,17 @@ mp4-box-encoding@^1.3.0: | |||
5788 | buffer-from "^1.1.0" | 5788 | buffer-from "^1.1.0" |
5789 | uint64be "^2.0.2" | 5789 | uint64be "^2.0.2" |
5790 | 5790 | ||
5791 | mp4-stream@^2.0.0: | ||
5792 | version "2.0.3" | ||
5793 | resolved "https://registry.yarnpkg.com/mp4-stream/-/mp4-stream-2.0.3.tgz#30acee07709d323f8dcd87a07b3ce9c3c4bfb364" | ||
5794 | integrity sha512-5NzgI0+bGakoZEwnIYINXqB3mnewkt3Y7jcvkXsTubnCNUSdM8cpP0Vemxf6FLg0qUN8fydTgNMVAc3QU8B92g== | ||
5795 | dependencies: | ||
5796 | buffer-alloc "^1.1.0" | ||
5797 | inherits "^2.0.1" | ||
5798 | mp4-box-encoding "^1.1.0" | ||
5799 | next-event "^1.0.0" | ||
5800 | readable-stream "^2.0.3" | ||
5801 | |||
5791 | mp4-stream@^3.0.0: | 5802 | mp4-stream@^3.0.0: |
5792 | version "3.0.0" | 5803 | version "3.0.0" |
5793 | resolved "https://registry.yarnpkg.com/mp4-stream/-/mp4-stream-3.0.0.tgz#8a2be63abe7fe8b57e28bf538e486b076880c485" | 5804 | resolved "https://registry.yarnpkg.com/mp4-stream/-/mp4-stream-3.0.0.tgz#8a2be63abe7fe8b57e28bf538e486b076880c485" |
@@ -5835,6 +5846,14 @@ multicast-dns@^6.0.1: | |||
5835 | dns-packet "^1.3.1" | 5846 | dns-packet "^1.3.1" |
5836 | thunky "^1.0.2" | 5847 | thunky "^1.0.2" |
5837 | 5848 | ||
5849 | multistream@^2.0.2: | ||
5850 | version "2.1.1" | ||
5851 | resolved "https://registry.yarnpkg.com/multistream/-/multistream-2.1.1.tgz#629d3a29bd76623489980d04519a2c365948148c" | ||
5852 | integrity sha512-xasv76hl6nr1dEy3lPvy7Ej7K/Lx3O/FCvwge8PeVJpciPPoNCbaANcNiBug3IpdvTveZUcAV0DJzdnUDMesNQ== | ||
5853 | dependencies: | ||
5854 | inherits "^2.0.1" | ||
5855 | readable-stream "^2.0.5" | ||
5856 | |||
5838 | multistream@^3.0.0: | 5857 | multistream@^3.0.0: |
5839 | version "3.0.0" | 5858 | version "3.0.0" |
5840 | resolved "https://registry.yarnpkg.com/multistream/-/multistream-3.0.0.tgz#93d6a672828c311a5b228212d319a5e9073d2e45" | 5859 | resolved "https://registry.yarnpkg.com/multistream/-/multistream-3.0.0.tgz#93d6a672828c311a5b228212d319a5e9073d2e45" |
@@ -7257,7 +7276,7 @@ read-pkg@^2.0.0: | |||
7257 | normalize-package-data "^2.3.2" | 7276 | normalize-package-data "^2.3.2" |
7258 | path-type "^2.0.0" | 7277 | path-type "^2.0.0" |
7259 | 7278 | ||
7260 | "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.4, readable-stream@^2.3.6, readable-stream@~2.3.6: | 7279 | "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.3, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.4, readable-stream@^2.3.6, readable-stream@~2.3.6: |
7261 | version "2.3.6" | 7280 | version "2.3.6" |
7262 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" | 7281 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" |
7263 | integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== | 7282 | integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== |
@@ -9251,6 +9270,19 @@ videostream@^3.2.0: | |||
9251 | pump "^3.0.0" | 9270 | pump "^3.0.0" |
9252 | range-slice-stream "^2.0.0" | 9271 | range-slice-stream "^2.0.0" |
9253 | 9272 | ||
9273 | videostream@~3.1: | ||
9274 | version "3.1.0" | ||
9275 | resolved "https://registry.yarnpkg.com/videostream/-/videostream-3.1.0.tgz#a265ea9bb94462604c3a480920ed0fae1e1fe5b9" | ||
9276 | integrity sha512-xCIjdqCyYnFxUAYs52GxheAAPO9V+hTQKs/yBUUGFK94db+kJ28B2hvDCnXACEnhX4hf9Cq7G3bVS+fOMpvXKw== | ||
9277 | dependencies: | ||
9278 | binary-search "^1.3.4" | ||
9279 | mediasource "^2.2.2" | ||
9280 | mp4-box-encoding "^1.3.0" | ||
9281 | mp4-stream "^2.0.0" | ||
9282 | multistream "^2.0.2" | ||
9283 | pump "^3.0.0" | ||
9284 | range-slice-stream "^2.0.0" | ||
9285 | |||
9254 | vm-browserify@^1.0.1: | 9286 | vm-browserify@^1.0.1: |
9255 | version "1.1.0" | 9287 | version "1.1.0" |
9256 | resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" | 9288 | resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" |