Server Version#: doesn’t matter
Player Version#: Flatpak 4.11.5, Android 4.11.5
I’m not talking about the randomization algorithm. They seem to have fixed that a couple years back. I’m talking about the ability to toggle shuffle. There’s a few weird cases I’ve seen:
When I play and/or shuffle an album from non-downloaded album, I am entirely unable to toggle shuffle.
When I play and/or shuffle an offline album, I am able to toggle shuffle. HOWEVER if I add an album to the queue I am unable to toggle.
If I play a song next, or add a song to any queue, if I was able to toggle shuffle before I am now not able too (both online and offline).
I think the issue comes from not knowing where to place a song added to the queue upon unshuffling, so the developers disabled it entirely. Here’s how I would personally handle this issue:
Keep two ordered queues. One which is called “unshuffled”, one “shuffled”.
When the player is unshuffled, the “shuffled” queue is empty and effectively disabled.
Adding items to next and adding to end work the same way. Just insert them where needed.
Upon shuffling, randomize a copy of the “unshuffled” queue and put it in the “shuffled” queue, keeping the currently played item at the front.
Adding items works the same way here too. Insert them into the “shuffled” queue just as you would the unshuffled. HOWEVER also add then to the end of the unshuffled queue (for both add next and add to end).
This way when unshuffling, the added songs stay in the queue. The fact that they always end up at the end is a concern, but it’s a reasonable tradeoff. I’d assume for most use cases it wouldn’t be an issue, considering you can re-shuffle.
Plexamp doesn’t do any shuffling, that is all done by the server.
This is due to a limitation the server enforces on shuffling play queues with “up next” regions. This is because we could never agree what to do with the tracks in that region which the user specifically added.
When you add an album (as opposed to playing the first track) we create an implicit Up Next region so that if you Add to Up Next it adds after the whole album and not just the first track.
In the future we’ll likely change the server behavior to not create that implicit region, since Plexamp now has an Add to Queue action as well as Add to Up Next.