Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable loudspeaker programmatically during a voip call

I want to enable loudspeaker programmatically during a voip call in ios app. Is it possible and how?

like image 565
Firdous Avatar asked Jul 13 '12 07:07

Firdous


2 Answers

Swift 3.0

try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, mode: AVAudioSessionModeVoiceChat, options: .defaultToSpeaker)
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
try AVAudioSession.sharedInstance().setActive(true)
like image 50
krish Avatar answered Nov 15 '22 07:11

krish


Look up the kAudioSessionProperty_OverrideAudioRoute key and the kAudioSessionOverrideAudioRoute_Speaker property in Apple's Audio Session documentation.

like image 41
hotpaw2 Avatar answered Nov 15 '22 07:11

hotpaw2