Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Play the online streaming radio in Android

I am developing one application where i want to play live stream radio. I have an url using which i will stream the radio and play. I have a play button by clicking which i want to play the radio. For that, i have written some code which is not at all working. Here is my code:

mp = new MediaPlayer();
try {

    mp.setOnPreparedListener(this);
    Log.d("Testing", "start111");
    mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
    String url="xxxxxx";
    mp.setDataSource(url);
    mp.prepareAsync();
} catch (IllegalArgumentException e) {
    e.printStackTrace();
    Log.d("Testing", "Exception ::: 1111 "+e.getMessage());
} catch (IllegalStateException e) {
    Log.d("Testing", "Exception ::: 2222 "+e.getMessage());
    e.printStackTrace();
} catch (IOException e) {
    Log.d("Testing", "IOException ::: 3333 "+e.getMessage());
    e.printStackTrace();
}

Can anyone please help me??

like image 806
Arindam Mukherjee Avatar asked Aug 11 '13 16:08

Arindam Mukherjee


1 Answers

You can find good information regarding radio streaming. Github radio streaming example

and also there is a question in SOF which can also be helpful Stackoverflow radio streaming example

Hope it will help. thanks

like image 125
Sandeep Avatar answered Sep 19 '22 17:09

Sandeep