This scenario fails every time Audio call If the sender uses the wifi network and the receiver uses mobile data 3G/4G network then the receiver hearing sender's voice but the receiver's voice can’t hear from the sender side.
peer connection is connected successfully with sender and receiver on both sides.
"peerConnection new connection state: checking" "peerConnection new connection state: connected"
also, we are using STUN and TURN servers like "stun:stun.l.google.com:19302" and config.iceServers = [RTCIceServer(urlStrings: ["turn:numb.viagenie.ca:3478"], username: "username@xyz.com", credential: "@password")]
please find below the Audio remote stream code:
private func configureAudioSession() {
self.rtcAudioSession.lockForConfiguration()
do {
try self.rtcAudioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try self.rtcAudioSession.setMode(AVAudioSessionModeVoiceChat)
} catch {
print("Error setting configuration: \(error.localizedDescription)")
}
self.rtcAudioSession.unlockForConfiguration()
}
private func createMediaSenders() {
let streamId = "XYZ"
let audioTrack = self.createAudioTrack()
self.peerConnection.add(audioTrack, streamIds: [streamId])
}
I'm trying to follow three steps of integration properly and working fine in my Application.
Configure WebRTC audio session to use manual audio and disable audio:
RTCAudioSession.sharedInstance().useManualAudio = true RTCAudioSession.sharedInstance().isAudioEnabled = false
On your CXProvider delegate's provider(CXProvider, didActivate
: AVAudioSession) method:
RTCAudioSession.sharedInstance().audioSessionDidActivate
with theRTCAudioSession.sharedInstance().isAudioEnabled = true
didDeactivate
: AVAudioSession) call RTCAudioSession.sharedInstance().audioSessionDidDeactivate
with the AVAudioSession from the CXProvider