Correctly dispose player components
This commit is contained in:
parent
39c0ceee8b
commit
809fecf2b4
|
@ -12,7 +12,10 @@ class BezelsPlugin extends Plugin {
|
||||||
player.addClass('vjs-bezels')
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ export interface EndCardOptions extends videojs.ComponentOptions, UpNextPluginOp
|
||||||
}
|
}
|
||||||
|
|
||||||
const Component = videojs.getComponent('Component')
|
const Component = videojs.getComponent('Component')
|
||||||
class EndCard extends Component {
|
export class EndCard extends Component {
|
||||||
options_: EndCardOptions
|
options_: EndCardOptions
|
||||||
|
|
||||||
dashOffsetTotal = 586
|
dashOffsetTotal = 586
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import videojs from 'video.js'
|
import videojs from 'video.js'
|
||||||
import { UpNextPluginOptions } from '../../types'
|
import { UpNextPluginOptions } from '../../types'
|
||||||
import { EndCardOptions } from './end-card'
|
import { EndCard, EndCardOptions } from './end-card'
|
||||||
|
|
||||||
const Plugin = videojs.getPlugin('plugin')
|
const Plugin = videojs.getPlugin('plugin')
|
||||||
|
|
||||||
|
@ -24,7 +24,10 @@ class UpNextPlugin extends Plugin {
|
||||||
player.addClass('vjs-upnext')
|
player.addClass('vjs-upnext')
|
||||||
})
|
})
|
||||||
|
|
||||||
player.addChild('EndCard', settings)
|
const component = new EndCard(player, settings)
|
||||||
|
|
||||||
|
player.addChild(component)
|
||||||
|
this.on('dispose', () => player.removeChild(component))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue