0

I am using simple audio streaming in android app like this:

    try   {
    MediaPlayer media = new MediaPlayer();
    media.setAudioStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    media.setDataSource("http://indiespectrum.com:9000");
    media.prepare();
    media.start();

}
catch(Exception e)
{
    //Getting Exception
}

Where I am using four different URL .When I start the radio streaming it takes a while to start playing.Sometimes it takes 5-6 sec and sometimes around 40-45 sec to start playing the radio. I just want to know if I can speed up these time taken .As all of these uses Shoutcast is there anyway I could speed up the connection or it depends on some kind of bitrate or something.Please help?

Navdroid
  • 1,541
  • 3
  • 25
  • 52

1 Answers1

0

One way to speed up things a lot is leveraging the UIMain thread and doing the audiostreaming using AsyncTask, wich enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.

Daniel Conde Marin
  • 7,588
  • 4
  • 35
  • 44