android音频管理器错误



我正试图将一个Shotcast直播流加载到audiomanager中,但我遇到了一个问题,它在wilfire 2.2 ofocial、wilfire 2.3 rooted、模拟器w/2.2上运行良好,而在optimus black 2.2 oficial和x10 mini pro 2.1 oficial上不工作。这是媒体播放器的bug还是什么?

代码很简单:

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)

你可以试试看是否更好,但我想这与无法播放文件类型的硬件有关

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();
    }
});

相关内容

  • 没有找到相关文章