@Max I did some debugging and manage to find the possible issue.
So, when the app is already running, everything works perfect, BUT, when the app is closed and the device is locked, the function "
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {" is not called.
I added some device debug logs to manage to debug the flow when the phone is closed, more about how to do this you have here:
I am just exploring debugging as per the subject line. I am noting that while this works easily enough, the NSLog's are not outputting, but breaks do get hit. This is not helping ;) .. I don't see ...
stackoverflow.com
You are going to need this to debug this flow and see what NSLogs you have from the app.
So, back to our topic, those are the logs I added when the app is already running - check Group 1.png - I added multiple prints in different places
And in the Group 2.png you have the flow when the device is closed.
As you can see, the log:
didFinishLaunchingWithOptions is showed in both cases, but the one I'm waiting for
didActivate audioSession is not being called.
Related on this topic:
developer.apple.com
Hi, I'm using Twilio video call in my app. I'm facing issues with call kit when the device was lock state. the receiver can hear the caller's voice and the caller can hear receiver voice during the...
github.com
developer.apple.com
I tried to move the setup of the audio session:
Code:
//Need for execute didActivate AudioSession on start app
private func setupAudioSession() {
DispatchQueue.global().sync {
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, options: AVAudioSession.CategoryOptions.mixWithOthers)
try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSession.PortOverride.none)
try AVAudioSession.sharedInstance().setMode(AVAudioSession.Mode.voiceChat)
try AVAudioSession.sharedInstance().setActive(true)
} catch _ {
}
}
}
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
NSLog("======== func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {")
setupAudioSession()
VideoCallInteractor.shared.publish()
}
I even tried (which makes sense for me) to do the following:
Code:
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
//other stuff
setupAudioSession()
action.fulfill(withDateConnected: NSDate.now)
}
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
NSLog("======== func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {")
// setupAudioSession()
VideoCallInteractor.shared.publish()
}
But still no luck...
In the function
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession), but I have the same issue.
I will keep you updated if I find a work around, let me if you have any feedback.