Android mediaPlayer Play reports PVMFErrNotSupported Prepare failed.: Status = 0x1 Analysis

2010-11-17  来源:本站原创  分类:Mobile  人气:276 

Android do today when a music player, when playing a song list, always reported an error: PVMFErrNotSupported
Prepare failed.: Status = 0x1

Check for a long time did not see where the error; but will file permissions or the file directory change the permissions on the folder 777 to be played normally; Subsequently, after the data access code found in a paragraph:
try {

mp = new MediaPlayer ();

mp.setDataSource (somePathToAudioFile);

mp.prepare ();

mp.start ();

} Catch (Exception e) {
}
There mp.setDataSource (somePathToAudioFile); this method is called setDataSource (String); in Java, there is a FileDescriptor; we can getFD () method to get a FileDescriptor; to avoid these errors;

Code is modified as follows:
String audioFilePath = getFilesDir (). GetAbsolutePath () + File.separator + "aa.mp4";

try {

File file = new File (audioFilePath);
FileInputStream fis = new FileInputStream (file);
mediaPlayer.setDataSource (fis.getFD ());
mediaPlayer.prepare ();
mediaPlayer.start ();

} Catch (FileNotFoundException e) {

} Catch (IllegalArgumentException e) {

} Catch (IllegalStateException e) {

} Catch (IOException e) {

}

Tested by;

相关文章
  • Android mediaPlayer Play reports PVMFErrNotSupported Prepare failed.: Status = 0x1 Analysis 2010-11-17

    Android do today when a music player, when playing a song list, always reported an error: PVMFErrNotSupported Prepare failed.: Status = 0x1 Check for a long time did not see where the error; but will file permissions or the file directory change the

  • 网络播放 MediaPlayer: Prepare failed status 0x1 2015-01-25

    MediaPlayer播放网络音频文件,部分机型报错:Prepare failed status 0x1,搜集网友的解决方案: File tempFile = new File(path); FileInputStream fis = new FileInputStream(tempFile); mediaPlayer.reset(); mediaPlayer.setDataSource(fis.getFD()); mediaPlayer.prepare(); mediaPlayer.start

  • android sdcard reading error PVMFErrNotSupported 2010-06-17

    Today to do a music player, android, when the play list of songs, always reported an error: PVMFErrNotSupported Prepare failed.: Status = 0x1 Check for a long time did not see where is the error; then after a while the data access code found inside t

  • The core principle of Android MediaPlayer 2010-06-25

    In this paper, is a very important Android is also the most complex media player (MediaPlayer) part of the structure. For a complete Android and relatively complex system, a function of the realization of MediaPlayer is not their specific function, b

  • Use android MediaPlayer to play audio files, sometimes prepareasync called in state 8 2010-11-15

    Use android MediaPlayer to play audio files, sometimes prepareasync called in state 8 errors . The following method avoids this anomaly appears. / ** * Play Internet audio files * @ Param audioUri * / private void playAudio (String audioUri) { Uri ur

  • Android MediaPlayer common method introduced 2010-12-21

    Android MediaPlayer common method introduced Method: create (Context context, Uri uri) Explanation: The static method, by Uri creating a multimedia player. Method: create (Context context, int resid) Explanation: The static method, through the resour

  • Android MediaPlayer状态图明晰注释 2012-03-28

    看Android ReferenceManual中MediaPlayer描述的状态机,那个状态图,看起来很复杂.笔者在初看到时也感觉一团乱麻,便试着按照状态转化的理解,先忽略一些不是特别重要的分支,自己绘制了一幅MediaPlayer的状态图.发现,跟AndroidSDK中的图呈现的内容是一致的,但是看起来却无比明晰,分享一下. 关于MediaPlayer状态的转换,Android SDK手册中已经有了明确的表述,这里笔者只是强调一些,SDK手册中明确表述的实际工作中遇到的问题点: 1. 异步P

  • Android MediaPlayer life cycle 2010-06-23

    MediaPlayer's state transition diagram is also characterized its life cycle, understand this map can help us consider the case when using MediaPlayer more comprehensive, write the code more robust. This state transition diagram a clear description of

  • Android MediaPlayer music 2010-07-04

    This example demonstrates the use MediaPlayer Play sdcard in the music, first in / sdcard / directory, adding music files (mp3), <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.c

  • Improve the first of the Android MediaPlayer 2010-12-19

    Written in front of fourteen articles on the interface of the entry, we all read and follow the exercises, the commonly used Layout and View will have a certain understanding, the next article describes the interface is no longer stressed, but rather

  • 深入Android MediaPlayer的使用方法详解 2015-02-19

    本篇文章是对Android中MediaPlayer的使用方法进行了详细的分析介绍,需要的朋友参考下 1)如何获得MediaPlayer实例:可以使用直接new的方式: MediaPlayer mp = new MediaPlayer(); 也可以使用create的方式,如: MediaPlayer mp = MediaPlayer.create(this, R.raw.test);//这时就不用调用setDataSource了 2) 如何设置要播放的文件:MediaPlayer要播放的文件主要包

  • android MediaPlayer API 2011-08-12

    MediaPlayer类可用于控制音频/视频文件或流的播放.关于如何使用这个类的方法还可以阅读VideoView类的文档. 1.状态图 对播放音频/视频文件和流的控制是通过一个状态机来管理的.下图显示一个MediaPlayer对象被支持的播放控制操作驱动的生命周期和状态.椭圆代表MediaPlayer对象可能驻留的状态.弧线表示驱动MediaPlayer在各个状态之间迁移的播放控制操作.这里有两种类型的弧线.由一个箭头开始的弧代表同步的方法调用,而以双箭头开头的代表的弧线代表异步方法调用. 通过

  • Android MediaPlayer状态机 2012-03-28

    翻译Android Reference Manual的MediaPlayer的状态机 对播放音频/视频文件和流的控制是通过一个状态机来管理的.下图显示一个MediaPlayer对象被支持的播放控制操作驱动的生命周期和状态.椭圆代表MediaPlayer对象可能驻留的状态.弧线表示驱动MediaPlayer在各个状态之间迁移的播放控制操作.这里有两种类型的弧线.由一个箭头开始的弧代表同步的方法调用,而以双箭头开头的代表的弧线代表异步方法调用. 通过这张图,我们可以知道一个MediaPlayer对象

  • android mediaplayer 视频修改视频大小 (屏幕尺寸mediaPlayer =... 2012-07-22

    1 主要是通过更改view 的大小来改变视频的大小. 2 在视频初始化时获得视频的高宽都为0 ,这个必须要注意,必须播放后延时 修改view 大小 3 sufaceview 的布局类是 android.widget.LinearLayout.LayoutParams 这个必须注意(在设置布局时一定要注意父对象的类型) 4 在 sufaceview surfaceChanged事件中加入 mediaPlayer.setDisplay(arg0) , setDisplay 方法在任意时刻都是可以调用

  • Android MediaPlayer的生命周期 2014-03-09

    这张状态转换图清晰的描述了MediaPlayer的各个状态,也列举了主要的方法的调用时序,每种方法只能在一些特定的状态下使用,如果使用时MediaPlayer的状态不正确则会引发IllegalStateException异常. 1: Idle 状态:当使用new MediaPlayer()创建一个MediaPlayer对象或者调用了其reset()时,该MediaPlayer对象处于idle状态.这两种方法的一个重要差别就是:如果在这个状态下调用了getDuration()等方法(相当于调用时机

  • Android MediaPlayer 2015-01-29

    MediaPlayer 这个类主要是播放视频类. AudioManager 这个类管理在一个设备上的音频资源和音频输出流. Manifest声明 1.网络声明 <uses-permission android:name="android.permission.INTERNET" /> 2.如果播放器应用需要将屏幕变暗或者停止处理器,或者需要调用 MediaPlayer.setScreenOnWhilePlaying() 或者 MediaPlayer.setWakeMode(

  • Android MediaPlayer Play the specified file location 2010-10-18

    Because the nature of the operation of the audio data file or a database mainly for internal content, such cases can be used data from a file or database will be read out and saved as a file by specifying the file path and then the way to play. Try a

  • Android Activity remove the title bar and status bar 2011-05-31

    First, set in the code public void onCreate (Bundle savedInstanceState) { super.onCreate (savedInstanceState); / / Remove title requestWindowFeature (Window.FEATURE_NO_TITLE); / / Remove the status bar above Activity getWindow (). setFlags (WindowMan

  • Android错误:Conversion to Dalvik format failed wi... 2012-07-24

    造成其出现错误的原因,不是因为android包的问题引起的,是因为你导入了其他的包,造成的冲突,project---->clean,如果还不行的话,就把那些包在导出来

  • android 错误:ddms: adb.exe,start-server' failed -- r 2014-11-20

    按照系统提示说的是任务管理器 kill掉adb.exe 或者重启adb server,但我任务管理器里kill掉adb.exe后,或者就没有adb.exe 还是不可以.原来是某个程序占用了adb.exe端口.按此思路查找: 5037为adb.exe默认端口 查看该端口情况如下: netstat -aon|findstr "5037" TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 6540 发现6540占用了 5037端口,继续查看6540的task,看是