开发者

Android - Audio recorder FileNotFound

开发者 https://www.devze.com 2022-12-23 13:04 出处:网络
I\'m trying to record audio this.recorder = new android.media.MediaRecorder(); this.recorder.setAudioSource(android.media.MediaRecorder.AudioSource.MIC);this.recorder.setOutputFormat(android.media.Me

I'm trying to record audio

this.recorder = new android.media.MediaRecorder();
this.recorder.setAudioSource(android.media.MediaRecorder.AudioSource.MIC);      this.recorder.setOutputFormat(android.media.MediaRecorder.开发者_StackOverflow社区OutputFormat.DEFAULT);
this.recorder.setAudioEncoder(android.media.MediaRecorder.AudioEncoder.DEFAULT);
this.recorder.setOutputFile("pruebaAudioRecorder.mp4");
**this.recorder.prepare();**
this.recorder.start();

but when i call prepare method throws the FileNotFound exception.

  • Should I create the file before prepare method? something like new File(...)
  • If so, which should be the file path?

thx a lot.


here is a great solution, remember to add the WRITE_EXTERNAL_STORAGE permission

http://www.benmccann.com/blog/android-audio-recording-tutorial/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号