From 4a7591e1a8ec5ffdff85580c6be4b18d8b85b4d4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 8 Jun 2018 15:35:18 +0200 Subject: Remove video not found --- client/src/assets/player/peertube-videojs-plugin.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'client/src/assets') 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 { this.torrent = webtorrent.add(magnetOrTorrentUrl, torrentOptions, torrent => { console.log('Added ' + magnetOrTorrentUrl + '.') - // Pause the old torrent if (oldTorrent) { + // Pause the old torrent oldTorrent.pause() // Pause does not remove actual peers (in particular the webseed peer) oldTorrent.removePeer(oldTorrent['ws']) // We use a fake renderer so we download correct pieces of the next file - // This way we'll be able to if (options.delay) { const fakeVideoElem = document.createElement('video') renderVideo(torrent.files[0], fakeVideoElem, { autoplay: false, controls: false }, (err, renderer) => { fakeRenderer = renderer - if (err) { - console.error('Cannot render new torrent in fake video element.', err) - } + if (err) console.error('Cannot render new torrent in fake video element.', err) // Load the future file at the correct time fakeVideoElem.currentTime = this.player.currentTime() + (options.delay / 2000) -- cgit v1.2.3