I have an android project that gives me an API of a music playlist without urls (just ids, titles and images) and has another API that will give me music detail by id including url and other information. I'm using ExoPlayer2.
Here is my problem, I want to prepare a playlist without urls first in ExoPlayer. When playing that playlist, I want to load the current music's url from my music detail API and update to that current playing list in ExoPlayer.
Can you please suggest me for the best solutions?
Currently, I'm solving in stupid way. That's when I want got a playlist from API, I looped and call details for each music first. After that, I transformed them as MediaSource and set to ExoPlayer.
It's worked. But as you guest, it takes a lot of time to play a playlist.
First of all, if you only have an id and you can't create a
MediaSource, you can pass theMediaItemto the player instance.MediaSourcewill be created viaMediaSource.Factoryyou can useDefaultMediaSourceFactoryor others, depending on your use caseAfter that, you can check out this issue on github, where marcbaechinger from exoplayer team answered a similar question. https://github.com/google/ExoPlayer/issues/10200