iOS7 introduces speechSynthesis API


Speech Synthesis api allows mobile safari to speak. It isn't the easiest thing to setup, but I have managed to do it. As with many things i've ran into some set backs.


One big setback. I was trying to get SS to read as soon as the window is loaded. Tried everything to trigger a button to submit a form. Nothing worked. I did have an EventListener, this allowed me to know my "code" click worked. Seemed as it submitted the form as well. (Shown above is a "code" click) meaning I have no user click, I just run a button and click it through the code. 

Hours of trying every work around, I went back to safari api. Noticed at the bottom that it will NOT speak unless a user interacts. Which is pretty crazy. So to test this, I first would manually click a button to submit the form and speak. After the button was clicked I set a timer to click it again through code. This time it worked.

I dunno what type of magic Apple has around that. As of now no work around. This doesn't mean there isn't one. 

To understand more you can try this weather app http://miWeatherSpeaks.blogspot.com
You must press the button for it to read. This is still a beta project, but if you have iOS7 it will speak.




No comments:

Post a Comment