美文网首页
java.io.IOException: Prepare fai

java.io.IOException: Prepare fai

作者: 满脸胡渣的年轻大叔 | 来源:发表于2017-02-23 13:08 被阅读1572次
    准备mediaPlay出错
                                                                      java.io.IOException: Prepare failed.: status=0x1
                                                                          at android.media.MediaPlayer._prepare(Native Method)
                                                                          at android.media.MediaPlayer.prepare(MediaPlayer.java:1218)
                                                                          at com.jumper.fhrinstruments.monitor.fhrmonitor.activity.PlayRecorderWavActivity.initMedia(PlayRecorderWavActivity.java:480)
                                                                          at com.jumper.fhrinstruments.monitor.fhrmonitor.activity.PlayRecorderWavActivity.initAudioTrack(PlayRecorderWavActivity.java:431)
                                                                          at com.jumper.fhrinstruments.monitor.fhrmonitor.activity.PlayRecorderWavActivity_.access$001(PlayRecorderWavActivity_.java:36)
                                                                          at com.jumper.fhrinstruments.monitor.fhrmonitor.activity.PlayRecorderWavActivity_$2.run(PlayRecorderWavActivity_.java:116)
                                                                          at android.os.Handler.handleCallback(Handler.java:755)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                          at android.os.Looper.loop(Looper.java:156)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:6524)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
    

    报错解决方案

    File file = new File(strPath);
    FileInputStream fis = new FileInputStream(file);
    mediaPlayer.setDataSource(fis.getFD());
    mp.prepare();
    

    相关文章

      网友评论

          本文标题:java.io.IOException: Prepare fai

          本文链接:https://www.haomeiwen.com/subject/mnfbwttx.html