1

I created Voice call recording app which works great with Phone's microphone and earpiece. But it's not able to record audio when earphones are inserted. I tried changing AudioSource to AudioSource.DEFAULT thinking that it automatically takes default audio source. It records nothing.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109

1 Answers1

2

You should be using the VOICE_CALL audio source if you want to record both the uplink and downlink audio. It should work regardless of whether you have a headset or headphones attached.

Keep in mind, though, that voice call recording is a platform-specific feature, and not something Google implements. So there are phones that simply do not support voice call recording, because the platform vendor or OEM didn't implement it, for whatever reason (lack of time, most likely).

Michael
  • 57,169
  • 9
  • 80
  • 125
  • Actually it's for some internal application of a call center. I first used VOICE_CALL. But it worked only in few phones. So we tested many phones with different audio sources and finally MIC audio source worked with Celkon A9 dual so we bought many those phones. It records both callee and caller's voices. But only problem now is now is irrespect of whether headset is inserted or not, it records audio using phone's mic instead of headset's mic. – Seshu Vinay Sep 10 '14 at 08:34
  • Now, I changed audio source to CAMCORDER. It works fine in both the cases. But during the call, if headset is plugged in, it doesn't record anything. And I would like to know if Audiosource can be changed while recording? So that I can have a broadcast receiver which broadcasts intent when headset is plugged in and change the audio source. – Seshu Vinay Sep 10 '14 at 08:41
  • No, you can't change the audio source while you're recording. You would have to stop/reset the recorder first (refer to [the `MediaRecorder` documentation](http://developer.android.com/reference/android/media/MediaRecorder.html)). If this is for a call center, aren't there better alternatives? Like a headset recording adapter that you connect to the phone, the caller's headset, and some sort of recording device (e.g. a PC). – Michael Sep 10 '14 at 08:50
  • But there are some phones in which video recorder can be paused and resume. How do you think they work? Do device manufacturers use some kind of trick? – Seshu Vinay Sep 10 '14 at 08:57
  • We need to automatically upload recorded files to S3. So we chose Android as it's easy to do that. Everything just worked fine until "Headset concept" got introduced. – Seshu Vinay Sep 10 '14 at 09:00
  • _"But there are some phones in which video recorder can be paused and resume."_ Pausing is not the same as changing the configuration (e.g. changing audio source). And in any case, if you've paused a recording you're not necessarily recording anything anymore (i.e. the app might actually stop the `MediaRecorder` when you tell it to pause). – Michael Sep 10 '14 at 09:04
  • Everything now is solved. I don't know what these device manufacturers did. But changing audio source to VOICE_UPLINK solves everything. It's working as required. – Seshu Vinay Sep 10 '14 at 09:12