Pregunta

I'm currently fooling around with speak.js: http://www.syntensity.com/static/espeak.html

Apparently the script only allows for one speak command to be executed, if I do like this:

speak("1");
speak("2");

... only "2" is read out.

Does anybody know how to troubleshoot a problem like this?

If you want to fiddle around: http://jsfiddle.net/timkl/YgWdh/

¿Fue útil?

Solución

What's happening is that both are being executed but the first gets trampled by the second. Look at this revision of your fiddle: http://jsfiddle.net/YgWdh/4/.

It uses a setTimeout to make sure the second line waits a bit before executing. But I don't see any API docs so I don't know how to make the second call wait only long enough for the first to finish.

Otros consejos

I think you'll have to do something like speak("1 2")

http://jsfiddle.net/K6GtQ/

I haven't had any experience with this library, but you might want to delay a time after speaking, because maybe if you let it speak another command right after it, it just overwrites the first speak.

Maybe you could investigate on meSpeak.js (http://www.masswerk.at/mespeak/), which is based on speak.js, and add support for callbacks. I am in no way affiliated to that project, but I am investigating in something which callbacks help to solve.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top