aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-videojs-plugin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts19
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'
4import { renderVideo } from './video-renderer' 4import { renderVideo } from './video-renderer'
5import './settings-menu-button' 5import './settings-menu-button'
6import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' 6import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
7import { 7import { getAverageBandwidth, getStoredMute, getStoredVolume, saveAverageBandwidth, saveMuteInStore, saveVolumeInStore } from './utils'
8 getAverageBandwidth,
9 getStoredMute,
10 getStoredVolume,
11 saveAverageBandwidth,
12 saveMuteInStore,
13 saveVolumeInStore
14} from './utils'
15import minBy from 'lodash-es/minBy' 8import minBy from 'lodash-es/minBy'
16import maxBy from 'lodash-es/maxBy' 9import maxBy from 'lodash-es/maxBy'
10import * as CacheChunkStore from 'cache-chunk-store'
11import { PeertubeChunkStore } from './peertube-chunk-store'
17 12
18const webtorrent = new WebTorrent({ 13const 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