I have a custom state called “queue” with a list of 2 or more audio files that is being referenced to play them in an audio player.
Displaying the current audio name is easy but I’d like to display the name of the next and previous audio file from the one thats currently playing from the list.
EX:
Previous: audio file 1
Currently playing: audio file 2
Up next: audio file 3
I found a temporary solution of using a repeating group and highlighting the audio file that is playing with a condition but I’d love to figure this out because it’ll be useful in other areas of the app.
I was trying "index: queue item #: Audio players current file… (I couldn’t find a expression that does the next or previous item in the list).
Does anyone know the dynamic expression to find the next item in a list?
Funny that I was also trying something similar yesterday where I have a list and I wanted to know how many times an individual item in a list has a property different from its previous element. So for example in your case to get a count of number of times a person is switching genre in their playlist items. Here I too felt a need to be able to figure out previous element for a specific element in the list.
I haven’t been able to think so far, so would be keen to know if someone can help here. So subscribing to this thread.
Also sorry I realised that you want to do this in frontend while I wanted to do in backend.
For frontend since you are in RG, you can do it using “current index”.
So next item can be “RG’ item# (current index + 1)”.
Similarly “-1” for previous.
If you want to access outside RG, you can use custom state I suppose to achieve this. So you create two custom states for “next song”, “previous song”. And then whenever song is changing, you have a workflow to populate these custom states which you can derive using “current index +1” etc that I showed earlier.