Search code examples
iosobjective-cxcodeavspeechsynthesizer

Objective c: BOOL check if AVSpecchUtterance is currently being uttered


I'm creating an iOS app that uses AVSpeechUtterance. An utterance is created when a button is pressed. Currently, if a user repeatedly taps the button, a new utterance will be queued up for each tap and they will repeatedly be uttered until each has played.

I want to modify this so an utterance will only be created if no other utterance is being uttered when the button is pushed. I figure this will be easiest with a simple boolean check. Does anyone know of any boolean that will allow me to check this?


Solution

  • Since what I really wanted to know was if the my AVSpeechSynthesizer was speaking, rather than the state of any particular utterance, all I needed to do was check with the BOOL:

    self.synth.speaking