diff options
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index a4f99559c..ac04421a7 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -4,16 +4,11 @@ import { VideoFile } from '../../../../shared/models/videos/video.model' | |||
4 | import { renderVideo } from './video-renderer' | 4 | import { renderVideo } from './video-renderer' |
5 | import './settings-menu-button' | 5 | import './settings-menu-button' |
6 | import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 6 | import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
7 | import { | 7 | import { getAverageBandwidth, getStoredMute, getStoredVolume, saveAverageBandwidth, saveMuteInStore, saveVolumeInStore } from './utils' |
8 | getAverageBandwidth, | ||
9 | getStoredMute, | ||
10 | getStoredVolume, | ||
11 | saveAverageBandwidth, | ||
12 | saveMuteInStore, | ||
13 | saveVolumeInStore | ||
14 | } from './utils' | ||
15 | import minBy from 'lodash-es/minBy' | 8 | import minBy from 'lodash-es/minBy' |
16 | import maxBy from 'lodash-es/maxBy' | 9 | import maxBy from 'lodash-es/maxBy' |
10 | import * as CacheChunkStore from 'cache-chunk-store' | ||
11 | import { PeertubeChunkStore } from './peertube-chunk-store' | ||
17 | 12 | ||
18 | const webtorrent = new WebTorrent({ | 13 | const webtorrent = new WebTorrent({ |
19 | tracker: { | 14 | tracker: { |
@@ -169,7 +164,13 @@ class PeerTubePlugin extends Plugin { | |||
169 | console.log('Adding ' + magnetOrTorrentUrl + '.') | 164 | console.log('Adding ' + magnetOrTorrentUrl + '.') |
170 | 165 | ||
171 | const oldTorrent = this.torrent | 166 | const oldTorrent = this.torrent |
172 | this.torrent = webtorrent.add(magnetOrTorrentUrl, torrent => { | 167 | const options = { |
168 | store: (chunkLength, storeOpts) => new CacheChunkStore(new PeertubeChunkStore(chunkLength, storeOpts), { | ||
169 | max: 100 | ||
170 | }) | ||
171 | } | ||
172 | |||
173 | this.torrent = webtorrent.add(magnetOrTorrentUrl, options, torrent => { | ||
173 | console.log('Added ' + magnetOrTorrentUrl + '.') | 174 | console.log('Added ' + magnetOrTorrentUrl + '.') |
174 | 175 | ||
175 | // Pause the old torrent | 176 | // Pause the old torrent |