Update playback rate hotkey adjustment

This commit is contained in:
advplyr 2023-04-08 11:17:17 -05:00
parent a59311f795
commit 56579f440b

View File

@ -218,18 +218,14 @@ export default {
} }
}, },
increasePlaybackRate() { increasePlaybackRate() {
var rates = [0.25, 0.5, 0.8, 1, 1.3, 1.5, 2, 2.5, 3] if (this.playbackRate >= 10) return
var currentRateIndex = rates.findIndex((r) => r === this.playbackRate) this.playbackRate = Number((this.playbackRate + 0.1).toFixed(1))
if (currentRateIndex >= rates.length - 1) return this.setPlaybackRate(this.playbackRate)
this.playbackRate = rates[currentRateIndex + 1] || 1
this.playbackRateChanged(this.playbackRate)
}, },
decreasePlaybackRate() { decreasePlaybackRate() {
var rates = [0.25, 0.5, 0.8, 1, 1.3, 1.5, 2, 2.5, 3] if (this.playbackRate <= 0.5) return
var currentRateIndex = rates.findIndex((r) => r === this.playbackRate) this.playbackRate = Number((this.playbackRate - 0.1).toFixed(1))
if (currentRateIndex <= 0) return this.setPlaybackRate(this.playbackRate)
this.playbackRate = rates[currentRateIndex - 1] || 1
this.playbackRateChanged(this.playbackRate)
}, },
setPlaybackRate(playbackRate) { setPlaybackRate(playbackRate) {
this.$emit('setPlaybackRate', playbackRate) this.$emit('setPlaybackRate', playbackRate)
@ -316,7 +312,7 @@ export default {
this.useChapterTrack = this.chapters.length ? _useChapterTrack : false this.useChapterTrack = this.chapters.length ? _useChapterTrack : false
if (this.$refs.trackbar) this.$refs.trackbar.setUseChapterTrack(this.useChapterTrack) if (this.$refs.trackbar) this.$refs.trackbar.setUseChapterTrack(this.useChapterTrack)
this.$emit('setPlaybackRate', this.playbackRate) this.setPlaybackRate(this.playbackRate)
}, },
settingsUpdated(settings) { settingsUpdated(settings) {
if (settings.playbackRate && this.playbackRate !== settings.playbackRate) { if (settings.playbackRate && this.playbackRate !== settings.playbackRate) {