From 0f8d12d78f26c71e11e3b217da691cfe174bc712 Mon Sep 17 00:00:00 2001 From: TDDR Date: Tue, 27 Oct 2020 15:20:41 -0400 Subject: [PATCH] Added ability to change volume with scroll wheel --- .../ft-video-player/ft-video-player.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/renderer/components/ft-video-player/ft-video-player.js b/src/renderer/components/ft-video-player/ft-video-player.js index 452564ad..c1caf303 100644 --- a/src/renderer/components/ft-video-player/ft-video-player.js +++ b/src/renderer/components/ft-video-player/ft-video-player.js @@ -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()