From e94fc2154b3238ce1db6b6b85f38b608ac2ab151 Mon Sep 17 00:00:00 2001 From: Daniil Date: Wed, 22 Nov 2023 16:28:24 +0200 Subject: [PATCH] Roll back playback rate index to 0 when at max speed Previously, when clicking on speed control button after max speed was selected it would reset to 1x. This behaviour is not inline with what originally was, so it was changed to roll back to index 0 (slowest speed) when clicking on speed control after max speed selected. --- assets/js/player.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index 3870d56a..d1b6469a 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -592,15 +592,14 @@ function increase_playback_rate(steps) { else { const maxIndex = options.playbackRates.length - 1; const curIndex = options.playbackRates.indexOf(player.playbackRate()); - // Reset speed if maximum selected - if (curIndex == maxIndex) { - speed = 1; - } - else{ - let newIndex = curIndex + steps; - newIndex = helpers.clamp(newIndex, 0, maxIndex); - speed = options.playbackRates[newIndex]; - } + let newIndex = curIndex; + // Set speed to minimum if at max speed + if (curIndex >= maxIndex) + newIndex = 0; + else + newIndex = curIndex + steps; + + speed = options.playbackRates[newIndex]; } } else {