Correctly dispose player components

pull/5898/head
Chocobozzz 2023-07-27 14:49:49 +02:00
parent 39c0ceee8b
commit 809fecf2b4
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 10 additions and 4 deletions

View File

@ -12,7 +12,10 @@ class BezelsPlugin extends Plugin {
player.addClass('vjs-bezels')
})
player.addChild(new PauseBezel(player, options))
const component = new PauseBezel(player, options)
player.addChild(component)
this.on('dispose', () => player.removeChild(component))
}
}

View File

@ -31,7 +31,7 @@ export interface EndCardOptions extends videojs.ComponentOptions, UpNextPluginOp
}
const Component = videojs.getComponent('Component')
class EndCard extends Component {
export class EndCard extends Component {
options_: EndCardOptions
dashOffsetTotal = 586

View File

@ -1,6 +1,6 @@
import videojs from 'video.js'
import { UpNextPluginOptions } from '../../types'
import { EndCardOptions } from './end-card'
import { EndCard, EndCardOptions } from './end-card'
const Plugin = videojs.getPlugin('plugin')
@ -24,7 +24,10 @@ class UpNextPlugin extends Plugin {
player.addClass('vjs-upnext')
})
player.addChild('EndCard', settings)
const component = new EndCard(player, settings)
player.addChild(component)
this.on('dispose', () => player.removeChild(component))
}
}