I have been trying to use AVSpeechSynthesizer
to read text from UIWebView
. The way I want to do it is:
- Using JS to get the top visible element on screen (i.e. p, h1, h2, h3 etc.)
- Splitting the element into an array of words using JS.
- One by one, each Word is highlighted(JS) and spoken using
AVSpeechSynthesizer
.
Now the problem is, since each word is spoken one at a time, it speaks very abruptly, like individual words and not a sentence.
What I want is that if would make the entire element speak with AVSpeechSynthesizer
and getting to know how for how long is being spoken so as to synchronise the highlighting or to somehow make individuals words being spoken right now maintain as a sentence.