Failure starting audio queue ≥˚˛ˇ When we AVSpeechSynthesizer.speak() after SFSpeechRecognizer

When I call function toggleSpeaking after SFSpeechRecognizer then I getting error "Failure starting audio queue ≥˚˛ˇ" error and speak does not working. If I didn't call SFSpeechRecognizer then toggleSpeaking works as expected.

Expected Results: AVSpeechSynthesizer.speak() should work when stopped SFSpeechRecognizer.

How could I fix this problem?

Via StackFlow: https://stackoverflow.com/questions/40639660/swift-3-using-speech-recognition-and-avfoundation-together


This will help you accomplish your goal.

let audioSession = AVAudioSession.sharedInstance() do { try audioSession.setCategory(AVAudioSessionCategoryPlayback) try audioSession.setActive(false, with: .notifyOthersOnDeactivation) } catch { / }

Hello my dear friends!

You should change this line:


try audioSession.setCategory(AVAudioSessionCategoryPlayback)

on to:

try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)


This should work ;-)

Failure starting audio queue ≥˚˛ˇ When we AVSpeechSynthesizer.speak() after SFSpeechRecognizer
 
 
Q