[AXTTSCommon] Failure starting audio queue

When the screen is unlocked the AVSpeechSynthesizer.speak is working fine and in locked not working


do {

try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, mode: .default, options: .defaultToSpeaker)

try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation)

} catch {

print("audioSession properties weren't set because of an error.")

}


let utterance = AVSpeechUtterance(string: voiceOutdata)

utterance.voice = AVSpeechSynthesisVoice(language: "en-US")


let synth = AVSpeechSynthesizer()

synth.speak(utterance)


defer {

disableAVSession()

}

Error Log in the locked state

[AXTTSCommon] Failure starting audio queue alp!

[AXTTSCommon] _BeginSpeaking: couldn't begin playback

Replies

Try using the option "duckOthers" instead, it worked for me.