aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-27 14:49:49 +0200
committerChocobozzz <me@florianbigard.com>2023-07-27 14:49:58 +0200
commit809fecf2b4683bd0e9890233f8a707c59e25134b (patch)
tree6d6ebe555d6045156845b3c6b21f3905c27de633
parent39c0ceee8b6e7fab441dea1ad1699fe8d18f3b27 (diff)
downloadPeerTube-809fecf2b4683bd0e9890233f8a707c59e25134b.tar.gz
PeerTube-809fecf2b4683bd0e9890233f8a707c59e25134b.tar.zst
PeerTube-809fecf2b4683bd0e9890233f8a707c59e25134b.zip
Correctly dispose player components
-rw-r--r--client/src/assets/player/shared/bezels/bezels-plugin.ts5
-rw-r--r--client/src/assets/player/shared/upnext/end-card.ts2
-rw-r--r--client/src/assets/player/shared/upnext/upnext-plugin.ts7
3 files changed, 10 insertions, 4 deletions
diff --git a/client/src/assets/player/shared/bezels/bezels-plugin.ts b/client/src/assets/player/shared/bezels/bezels-plugin.ts
index 6afb2c6a3..cf07dbd2c 100644
--- a/client/src/assets/player/shared/bezels/bezels-plugin.ts
+++ b/client/src/assets/player/shared/bezels/bezels-plugin.ts
@@ -12,7 +12,10 @@ class BezelsPlugin extends Plugin {
12 player.addClass('vjs-bezels') 12 player.addClass('vjs-bezels')
13 }) 13 })
14 14
15 player.addChild(new PauseBezel(player, options)) 15 const component = new PauseBezel(player, options)
16 player.addChild(component)
17
18 this.on('dispose', () => player.removeChild(component))
16 } 19 }
17} 20}
18 21
diff --git a/client/src/assets/player/shared/upnext/end-card.ts b/client/src/assets/player/shared/upnext/end-card.ts
index 16883603e..798a88db1 100644
--- a/client/src/assets/player/shared/upnext/end-card.ts
+++ b/client/src/assets/player/shared/upnext/end-card.ts
@@ -31,7 +31,7 @@ export interface EndCardOptions extends videojs.ComponentOptions, UpNextPluginOp
31} 31}
32 32
33const Component = videojs.getComponent('Component') 33const Component = videojs.getComponent('Component')
34class EndCard extends Component { 34export class EndCard extends Component {
35 options_: EndCardOptions 35 options_: EndCardOptions
36 36
37 dashOffsetTotal = 586 37 dashOffsetTotal = 586
diff --git a/client/src/assets/player/shared/upnext/upnext-plugin.ts b/client/src/assets/player/shared/upnext/upnext-plugin.ts
index 0badcd68c..45688978c 100644
--- a/client/src/assets/player/shared/upnext/upnext-plugin.ts
+++ b/client/src/assets/player/shared/upnext/upnext-plugin.ts
@@ -1,6 +1,6 @@
1import videojs from 'video.js' 1import videojs from 'video.js'
2import { UpNextPluginOptions } from '../../types' 2import { UpNextPluginOptions } from '../../types'
3import { EndCardOptions } from './end-card' 3import { EndCard, EndCardOptions } from './end-card'
4 4
5const Plugin = videojs.getPlugin('plugin') 5const Plugin = videojs.getPlugin('plugin')
6 6
@@ -24,7 +24,10 @@ class UpNextPlugin extends Plugin {
24 player.addClass('vjs-upnext') 24 player.addClass('vjs-upnext')
25 }) 25 })
26 26
27 player.addChild('EndCard', settings) 27 const component = new EndCard(player, settings)
28
29 player.addChild(component)
30 this.on('dispose', () => player.removeChild(component))
28 } 31 }
29} 32}
30 33