音频流中的Andr​​oid与MediPlayer类

问题描述:

我的MediPlayer类测试在Android的音频流。我想开发一个应用程序玩网页收音机。通过HTTP流的作品。在code以下做工精细的仿真器升级Froyo(V 2.2),但没有与Eclair的工作(V 2.1)

I'm testing the audio streaming in Android with the MediPlayer class. I want to develop an application to play web radios. The streaming over http works. The code below work fine on emulator with Froyo(v. 2.2) but didn't work with Eclair (v. 2.1)

// in onStartCommand   
String url = "http://........"; // your URL here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);  
mediaPlayer.prepareAsync(); // might take long! (for buffering, etc)

// in onPrepared
mediaPlayer.start();

但我的应用程序也应该对巧克力慕斯蛋糕的工作(V 2.1),我想知道如何在其上的MediaPlayer的工作。

But my app should also work on Eclair (v. 2.1) and I want to know how MediaPlayer work on it.

有人在Android的音频流的经验吗?

Someone has any experience with audio streaming in Android?

我有一个类似的问题。当我在preparedListener宣布我的赛道已经被加载。因此,对preparedListener没有工作。

I had a similar problem. When I declared onPreparedListener my track was already loaded. So onPreparedListener didn't work..