I need to play audio file from remote server in my app. I could play when I tested with localhost server (using WAMP). When the same file supplied from the server it is not
public void onRadioClick(View v) {
if (!isPLAYING) {
isPLAYING = true;
MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource(getString(R.string.audio_stream));
mp.prepare();
mp.start();
} catch (IOException e) {
Log.e(LOG_TAG, "prepare() failed");
}
} else {
isPLAYING = false;
stopPlaying();
}
}
private void stopPlaying() {
mp.release();
mp = null;
}