3

I am new to iOS and working on a mic to speaker app. My app should take input from external mic attached to audio jack and send the output to the mobile speaker. I am trying few things with AVAudiosession but didn't have much luck.

I have searched a lot on this platform and all of the results were very old and said it's not possible.

So, Have anyone tried this recently?

pavan
  • 91
  • 3
  • I don't think you can do it (see https://stackoverflow.com/a/24519938/22147), but have you tried overriding the audio output port like this https://stackoverflow.com/a/44482178/22147, except with `.speaker`? – Rhythmic Fistman Feb 09 '18 at 11:51
  • @RhythmicFistman According to https://developer.apple.com/library/content/qa/qa1754/_index.html AVAudioSessionPortOverrideSpeaker and AVAudioSessionCategoryOptionDefaultToSpeaker don't work for my case – pavan Feb 09 '18 at 13:15
  • Good link, that settles it. – Rhythmic Fistman Feb 09 '18 at 13:51
  • @RhythmicFistman yeah, these 2 options are not for my requirement, so I wanted to know if there are any other options which I can try, I am ok if the output sound comes from both headset earpiece and mobile speaker at a time – pavan Feb 10 '18 at 04:05
  • That sounds like a job for the multi route category, but sadly it has one important caveat: “The built-in speaker may only be used if no other eligible output ports are connected”. From https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionBasics/AudioSessionBasics.html. So what are your requirements? – Rhythmic Fistman Feb 10 '18 at 07:21
  • @RhythmicFistman I want my app to take input from external mic of the headset and play the sound from the mobile speaker. I am not bothered if it plays through earpiece or not – pavan Feb 10 '18 at 08:39
  • The (multi route) documentation says that you cannot do that. NB a real microphone without output should work, but not a headset. – Rhythmic Fistman Feb 10 '18 at 08:50
  • @RhythmicFistman I have connected my headset to the iPhone and when I get a call, I can listen to the sound both in headset earpiece and mobile speaker. Can this be a helpful option for me? can we do something to play this way? – pavan Feb 13 '18 at 11:47
  • You can listen to both at the same time? Speaker _and_ headphones? – Rhythmic Fistman Feb 13 '18 at 14:01
  • @RhythmicFistman Yes, I have tested it on iPhone 7 today by connecting headset to the" USB-to-audio jack" converter and I can listen to the ringtone on both earpieces and mobile speaker at the same time – pavan Feb 13 '18 at 17:08
  • Can you hear the subsequent call on both? Does it work on other models? – Rhythmic Fistman Feb 14 '18 at 06:09
  • @RhythmicFistman I can hear the call only in 1 port after I take the call, either earpiece or in mobile speaker when I press the speakerphone option in call – pavan Feb 14 '18 at 07:10

0 Answers0