Added ability to change volume with scroll wheel

This commit is contained in:
TDDR 2020-10-27 15:20:41 -04:00
parent 46c271aa22
commit 0f8d12d78f
1 changed files with 21 additions and 0 deletions

View File

@ -193,7 +193,9 @@ export default Vue.extend({
this.player.on('mousemove', this.hideMouseTimeout) this.player.on('mousemove', this.hideMouseTimeout)
this.player.on('mouseleave', this.removeMouseTimeout) this.player.on('mouseleave', this.removeMouseTimeout)
this.player.on('volumechange', this.updateVolume) this.player.on('volumechange', this.updateVolume)
this.player.controlBar.getChild('volumePanel').on('mousewheel', this.mouseScrollVolume)
const v = this const v = this
@ -216,6 +218,25 @@ export default Vue.extend({
sessionStorage.setItem('volume', volume) sessionStorage.setItem('volume', volume)
}, },
mouseScrollVolume: function (event) {
if (event.target) {
event.preventDefault()
if (this.player.muted() && event.wheelDelta > 0) {
this.player.muted(false)
this.player.volume(0)
}
if (!this.player.muted()) {
if (event.wheelDelta > 0) {
this.changeVolume(0.05)
} else if (event.wheelDelta < 0) {
this.changeVolume(-0.05)
}
}
}
},
determineFormatType: function () { determineFormatType: function () {
if (this.format === 'dash') { if (this.format === 'dash') {
this.enableDashFormat() this.enableDashFormat()