Android的MediaPlayer的投掷" prepare失败:状态=为0x1"在2.1,适用于2.2 [英] Android MediaPlayer throwing "Prepare failed.: status=0x1" on 2.1, works on 2.2

查看:167
本文介绍了Android的MediaPlayer的投掷" prepare失败:状态=为0x1"在2.1,适用于2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经真的敲我的头靠在桌子试图让MediaPlayer的类来尝试播放H.264-CN $ C $光盘上的视频的Andr​​oid 2.1。我的code是相当简单:

I've been really banging my head against the table trying to get the MediaPlayer class to try to play h.264-encoded videos on Android 2.1. My code is rather simple:

  AssetFileDescriptor fileDescriptor = getResources().openRawResourceFd(R.raw.my_movie);
  introMoviePlayer = new MediaPlayer();
  introMoviePlayer.setDataSource(fileDescriptor.getFileDescriptor(), fileDescriptor.getStartOffset(), fileDescriptor.getDeclaredLength());
  introMoviePlayer.prepare();

这总是抛出一个异常,在 prepare(),用文字 java.io.IOException异常:prepare失败。 :状态=为0x1 。我用了一点信息 MediaPlayer.create()有一个URI,这也会引发在 prepare(),这实际上是调用 MediaPlayer.create(),与消息命令PLAYER_ prePARE完成,错误或信息PVMFErrResourceConfiguration

This always throws an exception at prepare(), with the text java.io.IOException: Prepare failed.: status=0x1. I got a bit more info by using MediaPlayer.create() with a URI, which also throws at prepare(), which is actually called by MediaPlayer.create(), with the message Command PLAYER_PREPARE completed with an error or info PVMFErrResourceConfiguration.

同样的code完全在升级Froyo(2.2)。这些视频本身发挥优良的视频播放器应用程序。有没有人有可能是一个有益的提示,可能有助于解决这个问题?

The same code works perfectly in Froyo (2.2). The videos themselves play fine in the video player app. Does anyone have perhaps a helpful hint that might help to solve this problem?

修改:仍然无解 - 非常令人沮丧的问题确实。然而,我发现,通过创建一个 VideoView 和设置的URI的原始视频作品。这是很不解,因为通过的MediaPlayer类将抛出发送完全相同的URI。

Edit: Still no solution -- very frustrating problem indeed. However, I have found that by creating a VideoView and setting the URI for the raw video works. This is very puzzling, as sending the exact same URI through a MediaPlayer class will throw.

推荐答案

我不知道这是不是你的问题,但我只是找到了解决的描述Tuszy上述问题。我能读懂我是从外部存储而不是从高速缓存创建文件。

I do not know if this is your issue, but I just found a solution to the problem the described by Tuszy above. I could read the file I was creating from external storage but not from Cache.

解决的办法是,写文件时,读写权限不同。

The solution is that the read write permissions when writing the file are different.

请参见本博客,我发现这个极好的说明。

Please see this excellent explanation in this blog I found.

http://www.weston-fl.com/blog/?p= 2988

输入图像的描述在这里

输入图像的描述在这里

这篇关于Android的MediaPlayer的投掷" prepare失败:状态=为0x1"在2.1,适用于2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆