diff --git a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm index c7f7658c54..efcb8b383b 100644 --- a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm +++ b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm @@ -101,10 +101,11 @@ using Observers = NSHashTable; NSError * err = nil; if (![[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback - withOptions:AVAudioSessionCategoryOptionMixWithOthers | - AVAudioSessionCategoryOptionDuckOthers + mode:AVAudioSessionModeVoicePrompt + options:AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers | + AVAudioSessionCategoryOptionDuckOthers error:&err]) { - LOG(LWARNING, ("[ setCategory]] error.", [err localizedDescription])); + LOG(LWARNING, ("Couldn't configure audio session: ", [err localizedDescription])); } // Set initial StreetNamesTTS setting @@ -240,18 +241,11 @@ using Observers = NSHashTable; stopSession(); return; } else { - AVAudioSessionMode mode = AVAudioSessionModeDefault; - if ([MWMCarPlayService shared].isCarplayActivated) { - mode = AVAudioSessionModeVoicePrompt; - } - if (![[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback - mode:mode - options: - AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers | - AVAudioSessionCategoryOptionDuckOthers - error:nil] || - ![[AVAudioSession sharedInstance] setActive:YES error:nil]) + NSError * err = nil; + if (![[AVAudioSession sharedInstance] setActive:YES error:&err]) { + LOG(LWARNING, ("Couldn't activate audio session: ", [err localizedDescription])); return; + } for (NSString * notification in turnNotifications) [self speakOneString:notification];