Merge pull request #738 from TDDR/issue-573

Added ability to change volume with scroll wheel
This commit is contained in:
Luca Hohmann 2020-10-28 11:48:06 +01:00 committed by GitHub
commit 24adfbf89f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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('mouseleave', this.removeMouseTimeout)
this.player.on('volumechange', this.updateVolume)
this.player.controlBar.getChild('volumePanel').on('mousewheel', this.mouseScrollVolume)
const v = this
@ -216,6 +218,25 @@ export default Vue.extend({
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 () {
if (this.format === 'dash') {
this.enableDashFormat()