From b5f3cd14c2568cdc1c561b632b35e7d1b845b17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 30 May 2022 13:07:44 +0200 Subject: [PATCH] fix(ios) fix not using the loudspeaker by default Fixes: https://github.com/jitsi/jitsi-meet/issues/11563 --- ios/sdk/src/AudioMode.m | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ios/sdk/src/AudioMode.m b/ios/sdk/src/AudioMode.m index c993e79666..fc452cf162 100644 --- a/ios/sdk/src/AudioMode.m +++ b/ios/sdk/src/AudioMode.m @@ -248,6 +248,8 @@ RCT_EXPORT_METHOD(updateDeviceList) { - (void)audioSessionDidChangeRoute:(RTCAudioSession *)session reason:(AVAudioSessionRouteChangeReason)reason previousRoute:(AVAudioSessionRouteDescription *)previousRoute { + DDLogInfo(@"[AudioMode] Route changed, reason: %lu", (unsigned long)reason); + // Update JS about the changes. [self notifyDevicesChanged]; @@ -259,16 +261,12 @@ RCT_EXPORT_METHOD(updateDeviceList) { self->forceSpeaker = NO; self->forceEarpiece = NO; break; - case AVAudioSessionRouteChangeReasonCategoryChange: { - // The category has changed. Check if it's the one we want and adjust as - // needed. - RTCAudioSessionConfiguration *currentConfig = [self configForMode:self->activeMode]; - if ([session.category isEqualToString:currentConfig.category]) { - // We are in the desired category, nothing to do here. - return; - } + case AVAudioSessionRouteChangeReasonCategoryChange: + // The category has changed, re-apply our config. + // NB: It's tempting to doa category check here and skip the processing, + // but that won't work. If the config changes but the category remains + // the same we'll still find ourselves here. break; - } default: return; }