0

How can I enable speaker when call in progress, I am using this set of code, but this does not work

   let audioSession = AVAudioSession.sharedInstance()
    do {
        try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
        try audioSession.setMode(AVAudioSessionModeVoiceChat)
        try audioSession.overrideOutputAudioPort(AVAudioSessionPortOverride.speaker)
        try audioSession.setActive(true)
    } catch {
        print("AudioSession properties weren't set because of an error: \(error.localizedDescription)")
    }

This set of code only changes the output port to speaker, but speaker is not enabled for telephony call.

I need to enable the speaker in the telephony call UI. I do not mind use of private frameworks to achieve this. Any help will be appreciated.

Any updates ?

Jas_meet
  • 366
  • 1
  • 20

0 Answers0