views:

49

answers:

1

Hello I am currently new to android development I been working on the examples in the Dev Guide in the android website. I want to get a stream from a server I have to play in the emulator when I insert the url it doesn't seam to want to play. My question is there a way to get the emulator to play audio or is it all enabled also does MediaPlayer require a special kind of format like mp3 or ogg ? This is the code i am running on my 'onCreate()' method.

MediaPlayer mp - new MediaPlayer();
mp.setDataSource(MY_URL_);
mp.prepare();
mp.start();

Hope you guys can help my out.

A: 

The code is correct, it works on my device and it doesn't work on emulator. So I guess you need device to hear the sound.

Fedor