I am trying to make a very simple radio player for Android and I cannot get the audio streaming to work. In my latest attempt it plays for about 1 second and stops for some streams and it doesnt work at all for some other streams. Logcat doesn't give much useful information to me. I am testing on HTC Hero (Android 1.5).
If I hook the completion and buffer events I see the audio gets a complete event but it keeps buffering. Is there anything wrong with the code below? Should I be able to stream the the audio streams below? Is there a complete example somewhere of a working radio streaming? Thanks for any and all suggestions. public class MyActivity extends Activity implements OnPreparedListener { MediaPlayer streamPlayer = new MediaPlayer(); public void onPrepared(MediaPlayer mp) { streamPlayer.start(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String path = "http://www.nch.com.au/acm/sample.aac"; // String path = "http://radio.bis.bg:8000/buddhabar"; // String path = "http://kzsulive.stanford.edu/audio/kzsu-1-24.m3u"; try { Uri uri = Uri.parse(path); streamPlayer.reset(); streamPlayer.setDataSource(this, uri); streamPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); streamPlayer.setOnPreparedListener(this); streamPlayer.prepareAsync(); } catch (Exception e) { e.printStackTrace(); } setContentView(R.layout.main); } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en