WebRTC iOS video call- speaker audio is not working on latest iOS version

When using WebRTC video call on the latest iOS version, the loudspeaker audio isn't working, we have to listen to it on the earpiece.

Below is the code to set the loudspeaker.

do { 
try self.rtcAudioSession.setCategory(AVAudioSession.Category.playAndRecord.rawValue) 
try self.rtcAudioSession.setMode(AVAudioSession.Mode.default.rawValue) 
try self.rtcAudioSession.overrideOutputAudioPort(.speaker) 
} catch {
   print("error with loud speaker")
}
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum