1
votes

I am facing problem to play a audio url using MediaPlayer as well as native Android audio player. Here is my url http://live.politiafm.com:8500/politiafm.mp3

Here is my code Using native audio player Intent intent = new Intent(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(STREAM_URL), "audio/*"); StartActivity(intent); Using Media Player MediaPlayer mp = new MediaPlayer(); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); mp.create(Landing.this, Uri.parse(STREAM_URL));

    mp.prepareAsync();
    mp.start();

In both the cases audio is not playing. Can some body help me out from this trouble.

Thanks & Regards

2

2 Answers

0
votes

I guess it is to late a reply but in case if you are still facing the same problem,

you need to enable mime type for your server based on the type of the server. The MIME types are something you can learn from here how to enable them for Tomcat Server, IIS Server or Apache, whichever your mp3 file is hosted on : http://www.developershome.com/wap/wapServerSetup/tutorial.asp?page=settingUpMIME

Thanks

-1
votes

try changing

mp.prepare();

not

mp.prepareAsyunc();