0
Answered

Text-to-Speech auto play, race condition?

Robert Hamel 9 years ago in SitePal Silver updated by Gil Sideman 9 years ago 2
I have the Text-to-Speech tool working where it reads the text from the database, renders the page, creating the sayText function with the correct item to say, and runs.  Works great most the time, but it seems on occasion, the audio isn't playing. I put a 3 second delay using setTimeout, and that helps some, but on first load in a browser (no cache), and some slower connections, it occasionally stays silent.  If i click the replay button, it then works immediately, so I suspect there is a race condition happening where the js functions aren't able to trigger the flash to execute properly b/c the flash isn't loaded yet (or the include PHP file isn't loaded)  
Any idea how i can be sure that the file is loaded before triggering sayText?  
Under review
Robert - 

I noticed your post just now - I see this was posted some time ago 

Sounds you might not be waiting for the Scene to load before making calls to sayText. The documentation points out that you MUST implement the vh_sceneLoaded callback - and only after you get this call is the API assumed to be in working order.
Please take a look.

Let me know if this was the problem.
if not  - please post a link to the page where I might take a look & hopefully see the problem.
Regards
Gil 
SitePal Team