aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-videojs-plugin.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-08 15:35:18 +0200
committerChocobozzz <me@florianbigard.com>2018-06-08 15:35:18 +0200
commit4a7591e1a8ec5ffdff85580c6be4b18d8b85b4d4 (patch)
treefc167d50569885006ee6911819dce634586231e2 /client/src/assets/player/peertube-videojs-plugin.ts
parent696fa4c06b2351983740eb617ad46eb8eeb2c4e8 (diff)
downloadPeerTube-4a7591e1a8ec5ffdff85580c6be4b18d8b85b4d4.tar.gz
PeerTube-4a7591e1a8ec5ffdff85580c6be4b18d8b85b4d4.tar.zst
PeerTube-4a7591e1a8ec5ffdff85580c6be4b18d8b85b4d4.zip
Remove video not found
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts7
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)