准备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();
网友评论