I am new to Android development and I have the following question / issue.
I play with the MediaRecorder class to record only microphone sound. I follow the steps indicated on the official website: http://developer.android.com/reference/android/media/MediaRecorder.html
So, I have a method that initializes and sets up a MediaRecorder object to start recording. Here you have the code:
this.mr = new MediaRecorder(); this.mr.setAudioSource(MediaRecorder.AudioSource.MIC); this.mr.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); this.mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); this.mr.setOutputFile(this.path + this.fileName); try { this.mr.prepare(); } catch (IllegalStateException e) { Log.d("Syso", e.toString()); e.printStackTrace(); } catch (IOException e) { Log.d("Syso", e.toString()); e.printStackTrace(); }
When I run this code in the simulator, thanks to logcat, I see that the setAudioSource method (MediaRecorder.AudioSource.MIC) gives the following error (with the audio_ipunt tag) when it is called:
ERROR/audio_input(34): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value ERROR/audio_input(34): VerifyAndSetParameter failed
And then when the prepare () method is called, I get another error again:
ERROR/PVOMXEncNode(34): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.PV.amrencnb handle
If I start recording by calling the start () method ... I get a lot of messages saying:
AudioFlinger(34):RecordThread: buffer overflow
Then ... after stopping and releasing ... I see that the file was created, but it does not seem to be well written. Anway, if I try this on a real device, I can record without problems, but I CANโt play what I just recorded.
I believe the key is in these errors, which I mentioned earlier. How can I fix them? Any suggestion or help?