我正在尝试将一个shoutcast直播加载到audiomanager但我有一个问题,它在野火2.2 oficial,野火2.3 rooted,模拟器w / 2.2上工作正常,而不适用于optimus black 2.2 oficial和x10 mini pro 2.1公报。这是媒体播放器的错误还是什么?
代码很简单:
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource("http://150.214.174.129:8000/");
mediaPlayer.prepare();
mediaPlayer.start();
logcat不工作时:
03-18 00:28:05.371: W/AudioSystem(3345): AudioFlinger server died!
03-18 00:28:05.371: W/IMediaDeathNotifier(3345): media server died
03-18 00:28:05.371: E/MediaPlayer(3345): error (100, 0)
03-18 00:28:05.379: W/System.err(3345): java.io.IOException: Prepare failed.: status=0x64
03-18 00:28:05.379: W/System.err(3345): at android.media.MediaPlayer.prepare(Native Method)
03-18 00:28:05.379: W/System.err(3345): at es.radio.onCreate(pruebaradio.java:77)
03-18 00:28:05.379: W/System.err(3345): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-18 00:28:05.379: W/System.err(3345): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-18 00:28:05.379: W/System.err(3345): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-18 00:28:05.379: W/System.err(3345): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-18 00:28:05.379: W/System.err(3345): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-18 00:28:05.379: W/System.err(3345): at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 00:28:05.379: W/System.err(3345): at android.os.Looper.loop(Looper.java:123)
03-18 00:28:05.379: W/System.err(3345): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-18 00:28:05.379: W/System.err(3345): at java.lang.reflect.Method.invokeNative(Native Method)
03-18 00:28:05.379: W/System.err(3345): at java.lang.reflect.Method.invoke(Method.java:521)
03-18 00:28:05.379: W/System.err(3345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
03-18 00:28:05.379: W/System.err(3345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
03-18 00:28:05.379: W/System.err(3345): at dalvik.system.NativeStart.main(Native Method)
03-18 00:28:05.379: E/MediaPlayer(3345): start called in state 0
03-18 00:28:05.379: E/MediaPlayer(3345): error (-38, 0)
03-18 00:28:05.402: E/MediaPlayerJAVA(3345): Error (-38,0)
03-18 00:28:05.402: D/MediaPlayerJAVA(3345): Info (-38,0)
答案 0 :(得分:0)
你可以尝试,如果这更好,但我想这与硬件无法播放文件类型有关
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource("http://150.214.174.129:8000/");
mediaPlayer.prepareAsync();
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
});