Volumio2
Volumio2 copied to clipboard
repeatSingle status gets out of sync within pushState event
This happens when Repeat single track is enabled, and Repeat is disabled without providing repeatSingle argument. I believe this could be overcome by not nesting repeatSingle check inside repeat check. this would also make the repeatSingle status reflect the actual player status in every scenario.
repeat == false, repeatSingle = false -> Repeat is not enabled repeat == true, repeatSingle = false -> Repeat is enabled repeat == true, repeatSingle = true-> Repeat single is enabled repeat == false, repeatSingle = true -> Repeat is not enabled
I'm not familiar with javascript, but if i'm looking into a correct place this is where we decide next track
CoreStateMachine.prototype.getNextIndex = function () {
var nextIndex = this.currentPosition + 1;
var isLastTrack = (this.playQueue.arrayQueue.length - 1) == this.currentPosition;
// Check if Repeat mode is on and last track is played, note that Random and Consume overrides Repeat
if (this.currentRepeat) {
if (this.currentRepeatSingleSong) {
nextIndex = this.currentPosition;
} else if (isLastTrack) {
nextIndex = 0;
}
}
but i believe it could be rearranged like so, then the repeatSingle worked always if it was enabled.
if(this.currentRepeatSingleSong) {
nextIndex = this.currentPosition;
}
else if (this.currentRepeat && isLastTrack) {
nextIndex = 0;
}
Edit: put the code on blocks