Android AudioRecord Headphones with MIC

混江龙づ霸主 提交于 2020-03-03 09:09:32

问题


I am having some issues with the AudioRecord class. I have an app that records audio while someone is listening to audio through headphones. In this scenario, it works fine. Users are able to record without an issue. Any user using headphones with a built-in mic are not able to record at all. My class creates the .wav file from PCM data but no audio is being input from the mic. Its all silence.

I use the following the init my AudioRecorder:

extAudioRecorder = new ExtAudioRecorder(true, 
AudioSource.MIC, 
44100, 
AudioFormat.CHANNEL_IN_MONO, 
AudioFormat.ENCODING_PCM_16BIT);

Is there a problem trying to record using headphones w/ a mic in Android?

EDIT:

Just found out that the headphones dont even have to have a MIC and the internal mic is still disabled. Anyone know how to get around this?

http://code.google.com/p/android/issues/detail?id=4095


回答1:


Found out that some phones disable the built-in microphone when headphones are plugged in. Mostly Samsung devices.




回答2:


to force the use of builtin mic (at least on samsung devices), you can use MediaRecorder.AudioSource.CAMCORDER as source



来源:https://stackoverflow.com/questions/11077161/android-audiorecord-headphones-with-mic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!