loop entire trackgroups
simonv3 opened this issue · comments
It'd be nice if a user could loop a track group indefinitely.
I'm not sure how we'd do this, it might be something we store separately from the play queue and then reload it every time? Or we add another play mode that is loop: true
and if that happens then instead of popping from the queue we add tracks them back to the end?
Overall, I think this will tie in to creating our own UI for the react-h5-audio-player
component.
Considering we'll also need "previous" buttons to jump back in the play queue, it might actually be worth to have a play queue that is static, and actually just maintain a pointer to the current song. Alternatively we could keep "past songs played" in memory too, and grab from those when clicking "previous", and just reload those if there is a loop
variable?
Okay, here's what I'm thinking on this:
There'll be a fairly static queue that can basically only be added to or reset.
There's a couple of conditions under which it'll get reset:
- When a user clicks "play" on any trackgroup (release, playlist, etc), it'll remove the old songs and just add this trackgroup
- When a user clicks "clear queue" in the queue view
- When a user clicks "play" on a song already in the queue (or any tracklist) it'll reset the queue and load in the songs that come after that song.
Then we'll have a pointer variable playerQueueIndex
that points to the current position in the queue we're in.
We'll have a state variable that indicates what kind of loop we've got going playerQueueLoop: null | "loopQueue" | "loopTrack"
.
When the playerQueueIndex
reaches the end of the queue we'll act depending on the playerQueueLoop
variable.
This will need unit tests to test the state of the reducer.