No Audio on Incoming Calls and locked devices in CallKit

Hi,

I developed a Voip application using CallKit.

When my phone is unlocked and I receive incoming calls, the audio works.

But when my phone is unlocked. No sound at all. And when I click on my application and I get to it. I have the audio stream.

I have this error at the end but I don't understand the warning/error :

Unbalanced calls to begin/end appearance transitions for .

I am on 12.3.1 and I tested on 2 Iphones.

Thanks,

Replies

Hello,


We have also seen similar problem https://github.com/twilio/twilio-video-ios/issues/8


As mentioned on the github ticket the work around is -

            do {
                try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, mode: AVAudioSessionModeVoiceChat, options: .mixWithOthers)
                try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
                try AVAudioSession.sharedInstance().setActive(true)
            } catch {
                DDLogInfo("Speaker error : \(error)")
            }

            strongSelf.provider.reportNewIncomingCall(with: strongSelf.uuid, update: strongSelf


Is there a better solution for this issue?


Best,

Piyush

Hello,

Thank you very much for your answer, I tested your solution but when I am locked I get an error due to the setActive line (but I don't get an error when I am unlocked). Here is the error:

Speaker error: Error Domain=NSOSStatusErrorDomain Code=561017449"(null)"

(AVAudioSessionErrorInsufficientPriority).

I saw that on your post, the solution has still not been found. I will continue to investigate this error.

Thanks,