diff options
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 057bc4b2a..47288c842 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -195,22 +195,19 @@ class PeerTubePlugin extends Plugin { | |||
195 | this.torrent = webtorrent.add(magnetOrTorrentUrl, torrentOptions, torrent => { | 195 | this.torrent = webtorrent.add(magnetOrTorrentUrl, torrentOptions, torrent => { |
196 | console.log('Added ' + magnetOrTorrentUrl + '.') | 196 | console.log('Added ' + magnetOrTorrentUrl + '.') |
197 | 197 | ||
198 | // Pause the old torrent | ||
199 | if (oldTorrent) { | 198 | if (oldTorrent) { |
199 | // Pause the old torrent | ||
200 | oldTorrent.pause() | 200 | oldTorrent.pause() |
201 | // Pause does not remove actual peers (in particular the webseed peer) | 201 | // Pause does not remove actual peers (in particular the webseed peer) |
202 | oldTorrent.removePeer(oldTorrent['ws']) | 202 | oldTorrent.removePeer(oldTorrent['ws']) |
203 | 203 | ||
204 | // We use a fake renderer so we download correct pieces of the next file | 204 | // We use a fake renderer so we download correct pieces of the next file |
205 | // This way we'll be able to | ||
206 | if (options.delay) { | 205 | if (options.delay) { |
207 | const fakeVideoElem = document.createElement('video') | 206 | const fakeVideoElem = document.createElement('video') |
208 | renderVideo(torrent.files[0], fakeVideoElem, { autoplay: false, controls: false }, (err, renderer) => { | 207 | renderVideo(torrent.files[0], fakeVideoElem, { autoplay: false, controls: false }, (err, renderer) => { |
209 | fakeRenderer = renderer | 208 | fakeRenderer = renderer |
210 | 209 | ||
211 | if (err) { | 210 | if (err) console.error('Cannot render new torrent in fake video element.', err) |
212 | console.error('Cannot render new torrent in fake video element.', err) | ||
213 | } | ||
214 | 211 | ||
215 | // Load the future file at the correct time | 212 | // Load the future file at the correct time |
216 | fakeVideoElem.currentTime = this.player.currentTime() + (options.delay / 2000) | 213 | fakeVideoElem.currentTime = this.player.currentTime() + (options.delay / 2000) |