1 import { VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings'
3 const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
4 class ResolutionMenuItem extends MenuItem {
6 constructor (player: videojs.Player, options) {
7 const currentResolutionId = player.peertube().getCurrentResolutionId()
8 options.selectable = true
9 options.selected = options.id === currentResolutionId
11 super(player, options)
13 this.label = options.label
16 player.peertube().on('videoFileUpdate', () => this.update())
20 super.handleClick(event)
22 this.player_.peertube().updateResolution(this.id)
26 this.selected(this.player_.peertube().getCurrentResolutionId() === this.id)
29 MenuItem.registerComponent('ResolutionMenuItem', ResolutionMenuItem)
31 export { ResolutionMenuItem }