Skip to content

Commit

Permalink
fix: pause spoken audio like podcast or audiobook
Browse files Browse the repository at this point in the history
  • Loading branch information
fnazarios committed Jun 12, 2024
1 parent eb07e37 commit 01f42fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ios/TextToSpeech/TextToSpeech.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ + (BOOL)requiresMainQueueSetup
}

if([_ignoreSilentSwitch isEqualToString:@"ignore"]) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance]
setCategory:AVAudioSessionCategoryPlayback
mode:AVAudioSessionModeVoicePrompt
// This will pause a spoken audio like podcast or audiobook and duck the volume for music
options:AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers
error:nil
];
} else if([_ignoreSilentSwitch isEqualToString:@"obey"]) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
}
Expand Down

0 comments on commit 01f42fe

Please sign in to comment.