我有一门课是媒体播放器。我用来mp.setDataSource(path);
从 sdcard 获取文件。但是有了这个解决方案,我得到了错误。如何更改将数据设置为播放器工作的方式?我正在阅读有关 FileDescriptor 的信息。如何更改使用 FileDescriptor 的路径?
这是错误:
07-16 15:42:00.827: W/System.err(616): java.io.IOException: setDataSourceFD failed.: status=0x80000000
07-16 15:42:00.827: W/System.err(616): at android.media.MediaPlayer.setDataSource(Native Method)
07-16 15:42:00.827: W/System.err(616): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:976)
07-16 15:42:00.827: W/System.err(616): at VoiceRecorder$7.onClick(VoiceRecorder.java:306)
07-16 15:42:00.827: W/System.err(616): at android.view.View.performClick(View.java:4202)
07-16 15:42:00.827: W/System.err(616): at android.view.View$PerformClick.run(View.java:17341)
07-16 15:42:00.827: W/System.err(616): at android.os.Handler.handleCallback(Handler.java:725)
07-16 15:42:00.827: W/System.err(616): at android.os.Handler.dispatchMessage(Handler.java:92)
07-16 15:42:00.827: W/System.err(616): at android.os.Looper.loop(Looper.java:137)
07-16 15:42:00.827: W/System.err(616): at android.app.ActivityThread.main(ActivityThread.java:5039)
07-16 15:42:00.827: W/System.err(616): at java.lang.reflect.Method.invokeNative(Native Method)
07-16 15:42:00.827: W/System.err(616): at java.lang.reflect.Method.invoke(Method.java:511)
07-16 15:42:00.827: W/System.err(616): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-16 15:42:00.837: W/System.err(616): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-16 15:42:00.837: W/System.err(616): at dalvik.system.NativeStart.main(Native Method)
07-16 15:42:00.857: W/MessageQueue(616): Handler (android.media.MediaRecorder$EventHandler) {416bcf68} sending message to a Handler on a dead thread
07-16 15:42:00.857: W/MessageQueue(616): java.lang.RuntimeException: Handler (android.media.MediaRecorder$EventHandler) {416bcf68} sending message to a Handler on a dead thread
07-16 15:42:00.857: W/MessageQueue(616): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:294)
07-16 15:42:00.857: W/MessageQueue(616): at android.os.Handler.enqueueMessage(Handler.java:618)
07-16 15:42:00.857: W/MessageQueue(616): at android.os.Handler.sendMessageAtTime(Handler.java:587)
07-16 15:42:00.857: W/MessageQueue(616): at android.os.Handler.sendMessageDelayed(Handler.java:558)
07-16 15:42:00.857: W/MessageQueue(616): at android.os.Handler.sendMessage(Handler.java:495)
07-16 15:42:00.857: W/MessageQueue(616): at android.media.MediaRecorder.postEventFromNative(MediaRecorder.java:977)
07-16 15:42:00.857: W/MessageQueue(616): at dalvik.system.NativeStart.run(Native Method)