iosswiftavfoundationavspeechsynthesizeravspeechutterance

AVSpeechSynthesizer: how to display in a default player view


I use AVSpeechSynthesizer to play text books via audio.

private lazy var synthesizer: AVSpeechSynthesizer = {
    let synthesizer = AVSpeechSynthesizer()
    synthesizer.delegate = self
    return synthesizer
  }()

let utterance = AVSpeechUtterance(string: text)
    utterance.voice = AVSpeechSynthesisVoice(
      language: languageIdentifier(from: language)
    )
    synthesizer.speak(utterance)

I want to update information in iPhone's default player view (probably naming is wrong 🙏):

enter image description here

How can I accomplish this?


Solution

  • I really don't think you want to hack your way through this.. But if you really do I would: