Skip to content

Commit 7adcea1

Browse files
authored
fix(ios)!: create a separate audio session to automatically manage speech (#155)
BREAKING CHANGE: The app no longer manages the audio session. Co-authored-by: laurie <>
1 parent edf0dd0 commit 7adcea1

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

ios/Sources/TextToSpeechPlugin/TextToSpeech.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,8 @@ enum QUEUE_STRATEGY: Int {
1212

1313
override init() {
1414
super.init()
15+
self.synthesizer.usesApplicationAudioSession = false
1516
self.synthesizer.delegate = self
16-
// set session in background to avoid UI hangs.
17-
queue.async {
18-
do {
19-
let avAudioSessionCategory: AVAudioSession.Category = .playback
20-
try AVAudioSession.sharedInstance().setCategory(avAudioSessionCategory, mode: .default, options: .duckOthers)
21-
try AVAudioSession.sharedInstance().setActive(true)
22-
} catch {
23-
print("Error setting up AVAudioSession: \(error)")
24-
}
25-
}
2617
}
2718

2819
public func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didCancel utterance: AVSpeechUtterance) {

0 commit comments

Comments
 (0)