const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
class ResolutionMenuItem extends MenuItem {
- constructor (player: videojs.Player, options) {
+ constructor (player: any, options: any) {
const currentResolutionId = player.peertube().getCurrentResolutionId()
options.selectable = true
options.selected = options.id === currentResolutionId
player.peertube().on('autoResolutionUpdate', () => this.updateSelection())
}
- handleClick (event) {
+ handleClick (event: any) {
+ if (this.id === -1 && this.player_.peertube().isAutoResolutionForbidden()) return
+
super.handleClick(event)
// Auto resolution
}
updateSelection () {
+ // Check if auto resolution is forbidden or not
+ if (this.id === -1) {
+ if (this.player_.peertube().isAutoResolutionForbidden()) {
+ this.addClass('disabled')
+ } else {
+ this.removeClass('disabled')
+ }
+ }
+
if (this.player_.peertube().isAutoResolutionOn()) {
this.selected(this.id === -1)
return