1

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?

anon
  • 43
  • 1
  • 7
  • Regarding the API request part, see https://github.com/ryanheise/just_audio/pull/779 and consider giving feedback. – Ryan Heise Aug 17 '22 at 16:16
  • @RyanHeise I'm having a hard time understanding how to get the `tag` of the AudioSource generated by `MappingAudioSource`. I used to get it using the `currentSource ` of `sequenceStateStream` , but now it does not work because it's an instance of `MappingAudioSource`. – anon Aug 18 '22 at 22:49
  • I suggest asking the person who created that PR. I gave the link above. – Ryan Heise Aug 19 '22 at 08:08

0 Answers0