I\'m building an Android app that will stream several radio stations from a Latin Country, there is like 10 stations that I know can be played in android, I got the URL\'s f
In onResume or wrvr you want! Paste this code.
String url = "http://server2.crearradio.com:8371"; // your URL here
final MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mediaPlayer.setDataSource(url);
} catch (IOException e) {
e.printStackTrace();
}
try {
mediaPlayer.prepare(); // might take long! (for buffering, etc)
} catch (IOException e) {
e.printStackTrace();
}
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
mediaPlayer.start();
}
});
In the manifest.xml add the Internet permission.