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.
This commit is contained in:
Daniil 2023-11-22 16:28:24 +02:00
parent bed5f70d77
commit e94fc2154b

View File

@ -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 {