'Exoplayer Send playlist to service

Fm app My exoplayer playing in audioservice. my playlist of url from json. How can i send play list to service?

  public class AudioPlayerService extends Service {
  .....
   player = new ExoPlayer.Builder(this).build();
mProgressiveMediaSourceFactory = new ProgressiveMediaSource.Factory(OkhttpDataSourceFactory);
ConcatenatingMediaSource concatenatingMediaSource = new ConcatenatingMediaSource();

for (Samples.Sample sample : SAMPLES) {
  MediaSource mediaSource = 
  mProgressiveMediaSourceFactory.createMediaSource(MediaItem.fromUri(sample.uri));
  concatenatingMediaSource.addMediaSource(mediaSource);
}

And sample list is static

public static final Sample[] SAMPLES = new Sample[] {
  new Sample(
      "https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3",
      "audio_1",
      "Jazz in Paris",
      "Jazz for the masses",
      R.drawable.album_art_1),
  new Sample(
      "https://storage.googleapis.com/automotive-media/The_Messenger.mp3",
      "audio_2",
      "The messenger",
      "Hipster guide to London",
      R.drawable.album_art_2),
};

How can i update this sample from my json list? how can i update new play list?

my json"

  [
{
    "radio_title": "test1",
    "radio_img": "http://test1.png",
    "radio_url": "http://test1",
},
{
    "radio_title": "test2",
    "radio_img": "http://test2.png",
    "radio_url": "http://test2",
 },

we using Volley

 JSONArray ja = response.getJSONArray("post");
   for(int i=0; i < ja.length(); i++){
      Log.e(TAG, "onResponse: "+ obj.getString("title") );
   }

how can i update to playlist?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source