From 50dba6b471db8e30b2b956132a3a19d0bba31a68 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 19 Jun 2024 17:12:26 +0200 Subject: [PATCH] Fix CallKit audio session late init Signed-off-by: Nicolas Buquet --- MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m | 8 ++++++++ changelog.d/pr-1866.bugfix | 1 + 2 files changed, 9 insertions(+) create mode 100644 changelog.d/pr-1866.bugfix diff --git a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m index 84ea69a403..6fbb55d98a 100644 --- a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m +++ b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m @@ -226,6 +226,14 @@ - (void)reportIncomingCall:(MXCall *)call { update.supportsUngrouping = NO; update.supportsDTMF = NO; + // If the user tap the "Answer" button from Element's timeline, very often, he can't hear the other user. + // It's because the audio session is not configured at the beginiing of the call. + // It's a flaw in CallKit implementation. + // The audio session need to be configured earlier, like here. + // + // See https://developer.apple.com/forums/thread/64544 (7th post from Apple Engineer) + [self.audioSessionConfigurator configureAudioSessionForVideoCall:call.isVideoCall]; + [self.provider reportNewIncomingCallWithUUID:callUUID update:update completion:^(NSError * _Nullable error) { if (error) { diff --git a/changelog.d/pr-1866.bugfix b/changelog.d/pr-1866.bugfix new file mode 100644 index 0000000000..7d63fd13c5 --- /dev/null +++ b/changelog.d/pr-1866.bugfix @@ -0,0 +1 @@ +Fix CallKit audio session late init in VoIP call. \ No newline at end of file