准备失败的0x1 Android

时间:2013-09-29 11:54:08

标签: android

我有一个我正在尝试加载的wvm文件,但它在使用IO异常进行准备时总是失败。

如果我试图在同一设备上的VLC播放器中运行相同的网址,它将正常播放。

这是我的MediaPlayer代码

    mPlayer = MediaPlayer.create(context, Uri.parse(file_url));

    if(mPlayer != null){
        mPlayer.setSurface(s);
        mPlayer.setOnCompletionListener(this);
        mPlayer.setOnErrorListener(this);
        mPlayer.setOnInfoListener(this);
        mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

        video_prepared = true;
        if(got_initial_media_hit) {
            OnEvent(PLAYER_EVENT.load);
        }
    }
    else {
        OnError(PLAYER_ERRORS.player_not_loaded, "");
    }

这是我得到的错误

09-29 14:48:56.314: E/MediaPlayer(18209): error (1, -1)
09-29 14:48:56.334: D/MediaPlayer(18209): create failed:
09-29 14:48:56.334: D/MediaPlayer(18209): java.io.IOException: Prepare failed.: status=0x1
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.media.MediaPlayer.prepare(Native Method)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.media.MediaPlayer.create(MediaPlayer.java:792)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.media.MediaPlayer.create(MediaPlayer.java:769)
09-29 14:48:56.334: D/MediaPlayer(18209):   at com.tvinci.sdk.player.DefaultPlayer.initPlayer(DefaultPlayer.java:247)
09-29 14:48:56.334: D/MediaPlayer(18209):   at com.tvinci.sdk.player.DefaultPlayer.onSurfaceTextureAvailable(DefaultPlayer.java:287)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.TextureView.getHardwareLayer(TextureView.java:385)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12804)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12880)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.draw(View.java:13657)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.drawChild(ViewGroup.java:3083)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2920)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12833)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12880)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.draw(View.java:13657)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.drawChild(ViewGroup.java:3083)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2920)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12833)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12880)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.draw(View.java:13657)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.drawChild(ViewGroup.java:3083)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2920)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12833)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12880)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.draw(View.java:13657)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.drawChild(ViewGroup.java:3083)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2920)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.draw(View.java:13947)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.widget.FrameLayout.draw(FrameLayout.java:467)
09-29 14:48:56.334: D/MediaPlayer(18209):   at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2224)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12838)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.View.getDisplayList(View.java:12880)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1411)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1359)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewRootImpl.draw(ViewRootImpl.java:2367)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2239)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1872)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.Choreographer.doCallbacks(Choreographer.java:562)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.Choreographer.doFrame(Choreographer.java:532)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.os.Handler.handleCallback(Handler.java:730)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.os.Handler.dispatchMessage(Handler.java:92)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.os.Looper.loop(Looper.java:137)
09-29 14:48:56.334: D/MediaPlayer(18209):   at android.app.ActivityThread.main(ActivityThread.java:5103)
09-29 14:48:56.334: D/MediaPlayer(18209):   at java.lang.reflect.Method.invokeNative(Native Method)
09-29 14:48:56.334: D/MediaPlayer(18209):   at java.lang.reflect.Method.invoke(Method.java:525)
09-29 14:48:56.334: D/MediaPlayer(18209):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-29 14:48:56.334: D/MediaPlayer(18209):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-29 14:48:56.334: D/MediaPlayer(18209):   at dalvik.system.NativeStart.main(Native Method)

它能是什么? 感谢

编辑:

如果我使用的是VideoView,它就像魅力一样。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我遇到有关此Create函数的几个问题。

首先,似乎Java必须知道文件的类型,因此您必须在文件路径的开头写入“file://”。请参阅this answers

然后,稍后,我正在使用FilesDir.AbsolutePath附加我的文件路径,我之间错过了一个“/”。

所以这个错误确实与Create函数有关,而不是后来发生的事情。所以看看你的第一行。祝你好运。