Android无法创建媒体播放器

时间:2011-06-05 07:24:29

标签: android media-player

我用这段代码播放声音:

    mp = MediaPlayer.create(Start.this, R.raw.music);   
                mp.start();
                NameButton.setEnabled(false);
                mp.setOnCompletionListener(new OnCompletionListener() {

                    @Override
                    public void onCompletion(MediaPlayer mp) {

                        mp.release();
                        NameButton.setEnabled(true);
                    }

                });

效果很好。我用Audacity修改了文件的长度,现在eclipse和我的手机强制关闭了。

06-05 07:16:20.106: ERROR/MediaPlayer(427): Unable to to create media player
06-05 07:16:20.126: DEBUG/MediaPlayer(427): create failed:
06-05 07:16:20.126: DEBUG/MediaPlayer(427): java.io.IOException: setDataSourceFD failed.: status=0x80000000
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.media.MediaPlayer.setDataSource(Native Method)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.media.MediaPlayer.create(MediaPlayer.java:645)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at com.bfarago.clickme.Start$1.onClick(Start.java:108)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.view.View.performClick(View.java:2408)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.view.View$PerformClick.run(View.java:8816)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.os.Handler.handleCallback(Handler.java:587)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.os.Looper.loop(Looper.java:123)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at android.app.ActivityThread.main(ActivityThread.java:4627)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at java.lang.reflect.Method.invokeNative(Native Method)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at java.lang.reflect.Method.invoke(Method.java:521)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-05 07:16:20.126: DEBUG/MediaPlayer(427):     at dalvik.system.NativeStart.main(Native Method)
06-05 07:16:20.126: DEBUG/AndroidRuntime(427): Shutting down VM

我不知道问题是什么。 Android是否有可能无法播放非常短的声音(现在是1/10秒)?

0 个答案:

没有答案