aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 36b80bd72..adc376e94 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -55,8 +55,11 @@ class PeerTubePlugin extends Plugin {
55 private currentVideoFile: VideoFile 55 private currentVideoFile: VideoFile
56 private torrent: WebTorrent.Torrent 56 private torrent: WebTorrent.Torrent
57 private videoCaptions: VideoJSCaption[] 57 private videoCaptions: VideoJSCaption[]
58
58 private renderer 59 private renderer
59 private fakeRenderer 60 private fakeRenderer
61 private destoyingFakeRenderer = false
62
60 private autoResolution = true 63 private autoResolution = true
61 private forbidAutoResolution = false 64 private forbidAutoResolution = false
62 private isAutoResolutionObservation = false 65 private isAutoResolutionObservation = false
@@ -599,11 +602,16 @@ class PeerTubePlugin extends Plugin {
599 } 602 }
600 603
601 private renderFileInFakeElement (file: WebTorrent.TorrentFile, delay: number) { 604 private renderFileInFakeElement (file: WebTorrent.TorrentFile, delay: number) {
605 this.destoyingFakeRenderer = false
606
602 const fakeVideoElem = document.createElement('video') 607 const fakeVideoElem = document.createElement('video')
603 renderVideo(file, fakeVideoElem, { autoplay: false, controls: false }, (err, renderer) => { 608 renderVideo(file, fakeVideoElem, { autoplay: false, controls: false }, (err, renderer) => {
604 this.fakeRenderer = renderer 609 this.fakeRenderer = renderer
605 610
606 if (err) console.error('Cannot render new torrent in fake video element.', err) 611 // The renderer returns an error when we destroy it, so skip them
612 if (this.destoyingFakeRenderer === false && err) {
613 console.error('Cannot render new torrent in fake video element.', err)
614 }
607 615
608 // Load the future file at the correct time (in delay MS - 2 seconds) 616 // Load the future file at the correct time (in delay MS - 2 seconds)
609 fakeVideoElem.currentTime = this.player.currentTime() + (delay - 2000) 617 fakeVideoElem.currentTime = this.player.currentTime() + (delay - 2000)
@@ -612,6 +620,8 @@ class PeerTubePlugin extends Plugin {
612 620
613 private destroyFakeRenderer () { 621 private destroyFakeRenderer () {
614 if (this.fakeRenderer) { 622 if (this.fakeRenderer) {
623 this.destoyingFakeRenderer = true
624
615 if (this.fakeRenderer.destroy) { 625 if (this.fakeRenderer.destroy) {
616 try { 626 try {
617 this.fakeRenderer.destroy() 627 this.fakeRenderer.destroy()