0 Replies
      Latest reply on Apr 18, 2019 3:04 AM by ruwabi
      ruwabi Level 1 Level 1 (0 points)

        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