Search code examples
iosobjective-cios7avspeechsynthesizer

AVSpeechSynthesis ended


Hi I'm building an iOS 7 app using AVSpeechSynthesizer and AVSpeechUtterance I'm trying to figure out when the synthesis is done. To be more specific I'd love to change the appereance of the play/pause button when the synthesis is over. Someone can help me understand if there is some method called at the end of the synthesis? Thanks in advance


Solution

  • Set the delegate property of AVSpeechSynthesizer and implement the following delegate method:

    - (void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didFinishSpeechUtterance:(AVSpeechUtterance *)utterance {
        //do whatever you need to do
    }
    

    You may also be interested in speechSynthesizer:didCancelSpeechUtterance: delegate method if you stop speaking programatically (for example, after a button is pressed).