|
@@ -248,6 +248,8 @@ RCT_EXPORT_METHOD(updateDeviceList) {
|
248
|
248
|
- (void)audioSessionDidChangeRoute:(RTCAudioSession *)session
|
249
|
249
|
reason:(AVAudioSessionRouteChangeReason)reason
|
250
|
250
|
previousRoute:(AVAudioSessionRouteDescription *)previousRoute {
|
|
251
|
+ DDLogInfo(@"[AudioMode] Route changed, reason: %lu", (unsigned long)reason);
|
|
252
|
+
|
251
|
253
|
// Update JS about the changes.
|
252
|
254
|
[self notifyDevicesChanged];
|
253
|
255
|
|
|
@@ -259,16 +261,12 @@ RCT_EXPORT_METHOD(updateDeviceList) {
|
259
|
261
|
self->forceSpeaker = NO;
|
260
|
262
|
self->forceEarpiece = NO;
|
261
|
263
|
break;
|
262
|
|
- case AVAudioSessionRouteChangeReasonCategoryChange: {
|
263
|
|
- // The category has changed. Check if it's the one we want and adjust as
|
264
|
|
- // needed.
|
265
|
|
- RTCAudioSessionConfiguration *currentConfig = [self configForMode:self->activeMode];
|
266
|
|
- if ([session.category isEqualToString:currentConfig.category]) {
|
267
|
|
- // We are in the desired category, nothing to do here.
|
268
|
|
- return;
|
269
|
|
- }
|
|
264
|
+ case AVAudioSessionRouteChangeReasonCategoryChange:
|
|
265
|
+ // The category has changed, re-apply our config.
|
|
266
|
+ // NB: It's tempting to doa category check here and skip the processing,
|
|
267
|
+ // but that won't work. If the config changes but the category remains
|
|
268
|
+ // the same we'll still find ourselves here.
|
270
|
269
|
break;
|
271
|
|
- }
|
272
|
270
|
default:
|
273
|
271
|
return;
|
274
|
272
|
}
|