I have a playlist generated with dummy source urls (it only has the source url of the playing audio and the others are fake) and when I click "next" I want to send an api request to get the real source url and update the sources of the playlist.
If I generate a new _playlist
with the correct source and I do something like:
_audioPlayer.setAudioSource(_playlist, initialIndex: nextAudioIndex, initialPosition: Duration.zero);
the playlist (sequenceState.effectiveSequence
) gets re-shuffled and the next audio of the previous order becomes the first one.
If I only do await _audioPlayer.seekToNext();
, I get an error because the audio source is fake and I didn't update it with the api request result.
The reason I have dummy source urls is to not send a lot of requests at the beginning and wait for them. Is there a way to do this?