Improve CallKit tutorial, that was missing important information.

master
Simon Morlat 1 year ago
parent 3257bdb7ad
commit 6c7585aac8

@ -74,6 +74,11 @@ extension CallKitProviderDelegate: CXProviderDelegate {
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
do {
// The audio stream is going to start shortly: the AVAudioSession must be configured now.
// It is worth to note that an application does not have permission to configure the
// AVAudioSession outside of this delegate action while it is running in background,
// which is usually the case in an incoming call scenario.
tutorialContext.mCore.configureAudioSession();
try tutorialContext.mCall?.accept()
tutorialContext.isCallRunning = true
} catch {
@ -83,17 +88,27 @@ extension CallKitProviderDelegate: CXProviderDelegate {
}
func provider(_ provider: CXProvider, perform action: CXSetHeldCallAction) {}
func provider(_ provider: CXProvider, perform action: CXStartCallAction) {}
func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
// This tutorial is not doing outgoing calls. If it had to do so,
// configureAudioSession() shall be called from here, just before launching the
// call.
// tutorialContext.mCore.configureAudioSession();
// tutorialContext.mCore.invite("sip:bob@example.net");
// action.fulfill();
}
func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {}
func provider(_ provider: CXProvider, perform action: CXPlayDTMFCallAction) {}
func provider(_ provider: CXProvider, timedOutPerforming action: CXAction) {}
func providerDidReset(_ provider: CXProvider) {}
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
// The linphone Core must be notified that CallKit has activated the AVAudioSession
// in order to start streaming audio.
tutorialContext.mCore.activateAudioSession(actived: true)
}
func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
// The linphone Core must be notified that CallKit has deactivated the AVAudioSession.
tutorialContext.mCore.activateAudioSession(actived: false)
}
}

Loading…
Cancel
Save