I am using a MediaPlayer
to stream an .mp3
file from a server. This is the code:
void start1(String a){
mp.setDataSource(a);//mp is a properly initialized global MediaPlayer variable
mp.setOnPreparedListener(this);
mp.prepareAsync();
}catch(Exception e){
noerror=false;
}
}
@Override
public void onPrepared(MediaPlayer mp1){
mp.start();
}
The audio starts playing in around 5 seconds on Android API versions 17,16,15 and 14. But in all API versions below 14, the audio takes about 1 minute and 30 seconds to start. What should I do to decrease the time to 5 seconds?