Hello guys!
I’m having a situation similar to some extent as mentioned here: How to replace songs array? · Issue #184 · serversideup/amplitudejs · GitHub. That discussion does not seem to have reached a conclusion, so here I’m opening new thread about it.
On the click of a button, I need to remove all songs from the current queue and add a new song.
So, I tried something like:
Amplitude.getSongs().forEach((song, songIndex) => {
Amplitude.removeSong(songIndex);
});
// addition handled later
I thought this would work, but it’s removing only the alternate songs as of now. From my understanding, Amplitude.getSongs()
returns an array. On that, I’m using forEach
and accessing the index of each song using the songIndex
argument. I’m passing that value to Amplitude.removeSong()
. Am I missing something or is this not possible at all?