Select text while Text to Speech is running

I am developing an ipad application in which I want to add functionality, as shown below: -

enter image description here

When the user presses the play button, text to speech will begin to play that text at this time, this word will be highlighted as they are read.

I know about the built-in iOS function, but I want to do it programmatically.

I searched a lot and got the following:

Link 1

Link 2

Link 3

If anyone knows any API or some kind of built-in framework. Let me know.

Rate your time.

+5
source share
1 answer

You can use the brilliant text-to-speech library built into iOS 7 called AVSpeechSynthesizer.

You can manage the speech, as well as receive notifications about it, using the delegation methods of AVSpeechSynthesizer. A method that should help you achieve the desired functionality should be speechSynthesizer:willSpeakRangeOfSpeechString:utterance:

See the AVSpeechSynthesizer , as well as the AVSpeechSynthesizerDelegate API link

This post , written by Matt Thompson at NSHipster, shows an example with the same functionality.

+7
source

Source: https://habr.com/ru/post/1205752/


All Articles