swift – switch to ear piece of WKWebview WebRTC call possible?

i am using a WKWebview(webrtc) for audio call
initially the call is connected to audio output – speaker
but once i change the outport to ear piece – no sound

i am switching to ear piece once the call gets connected(it is received in handler).
once i received the status, using the following method, i changed to ear piece

try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSession.PortOverride.none)
             
try AVAudioSession.sharedInstance().setActive(true)

but once i call this method, audio becomes mute.
Anyhelp would be appreciable?

Read more here: Source link