Forcing Mediarecorder To Use Internal Microphone
I'm using something like this to initiate audio recording: MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputF
Solution 1:
Unfortunately, you're trying to go against Android's audio management, this is, the system selects input device depending on selected audio source and, when the headset is pluged in, input, for MIC audio source, is switched to the headset. You can confirm this checking logcat's AudioPolicyManager's related messages.
My suggestion would be playing with different audio sources to trick the system. I would recommend using CAMCORDER or, at least, try VOICE_RECOGNITION or VOICE_COMMUNICATION.
Main problem with CAMCORDER is that it can be using multimedia microphone, this is, the one at the back of the device. More in detail, I would suggest following procedure:
- Listen for ACTION_HEADSET_PLUG Intent.
- When you receive the intent, try to switch audio source to CAMCORDER.
- CAMCORDER audio source is selected depending on active camera so you can try to force front camera usage (and, then, front internal mic) through MediaREcorder's setCamera
Hope this helps
Post a Comment for "Forcing Mediarecorder To Use Internal Microphone"