mirror of
https://codeberg.org/dragongoose/safetwitch.git
synced 2024-09-06 08:42:31 +00:00
Fix quality selector
This commit is contained in:
parent
a79841af62
commit
8c5a9c7041
1 changed files with 16 additions and 4 deletions
|
@ -32,6 +32,7 @@ export const createQualitySelector = (player: any) => {
|
|||
|
||||
return this.options_.items.map((item: { name: string }) => {
|
||||
const qualitySelectorButton = new MenuItem(player, { label: item.name })
|
||||
|
||||
qualitySelectorButton.handleClick = (data) => {
|
||||
const qualityClicked = data.currentTarget.innerText
|
||||
const id = formatedQualities.find((i) => i.name === qualityClicked)?.id
|
||||
|
@ -44,8 +45,21 @@ export const createQualitySelector = (player: any) => {
|
|||
return qualitySelectorButton
|
||||
})
|
||||
}
|
||||
|
||||
buildCSSClass() {
|
||||
return `vjs-icon-cog ${super.buildCSSClass()}`
|
||||
}
|
||||
}
|
||||
videojs.registerComponent('CustomMenuButton', CustomMenuButton)
|
||||
const formattedLevels = []
|
||||
|
||||
const updateLevels = (items: { name: string; index: number; id: string; }[]) => {
|
||||
player.controlBar.removeChild('CustomMenuButton')
|
||||
player.controlBar.addChild('CustomMenuButton', {
|
||||
title: 'Qualities',
|
||||
items: formatedQualities
|
||||
})
|
||||
}
|
||||
|
||||
qualityLevels.on('addqualitylevel', () => {
|
||||
formatedQualities = qualityLevels.levels_.map((quality: QualityLevel) => {
|
||||
|
@ -56,10 +70,8 @@ export const createQualitySelector = (player: any) => {
|
|||
}
|
||||
})
|
||||
|
||||
player.controlBar.addChild('CustomMenuButton', {
|
||||
title: 'Qualities',
|
||||
items: formatedQualities
|
||||
})
|
||||
formattedLevels.push(formatedQualities)
|
||||
updateLevels()
|
||||
})
|
||||
|
||||
qualityLevels.on('change', function () {
|
||||
|
|
Loading…
Reference in a new issue