The playback environment generates event callbacks which correspond to different stages of playback. The host site can use these event callbacks to synchronize other actions to audio playback.
On API Loaded:
vw_apiLoaded() - is generated when a API is loaded.
On Talk Started:
vw_talkStarted() - is generated when speech begins.
On Talk Ended:
vw_talkEnded() - is generated when speech ends.
Audio Progress:
vw_audioProgress(percentPlayed) - is generated at an audio progress interval.
setStatus() - use setStatus to set the progress interval to receive Progress callbacks.
Example : Synchronizing with Playback
<html>
<head>
<script language="JavaScript" type="text/javascript" src="http://vhss-d.oddcast.com/vocalware_embed_functions.php?acc=3314795&js=1"></script>
<script language="javascript">
function vw_apiLoaded(){
setStatus(0,1)
document.forms[0].message.value += "Received 'vw_apiLoaded' event'setStatus(0,1)' \n";
}
function vw_talkStarted(){
document.forms[0].message.value += "Received 'vw_talkStarted' event \n";
}
function vw_talkEnded(){
document.forms[0].message.value += "Received 'vw_talkEnded' event \n";
}
function vw_audioProgress(percentPlayed){
document.forms[0].message.value += "Received 'vw_audioProgress' at " + percentPlayed + "% \n";
}
function sayTextLocal(){
document.forms[0].message.value = "";
sayText('Welcome to Vocalware Support',3,1,3);
sayText('How can I help you today?',3,1,3);
}
</script>
</head>
<body>
<!-- This function call needs to be in or after the body tag -->
<script language="JavaScript" type="text/javascript">
AC_Vocalware_Embed(3314795, 1, 1, '', 0, 1, 2504354, 0, 1, 0, 'e704f7a6017aab05093b2cb079e00e4e', 9);
</script>
<img src="https://www.vocalware.com/images/support/welcome_to_vocalware_support.jpg"><br/><br/>
<a style=" font-size:120%;" href="javascript:sayTextLocal();"> Play Audio</a><br/>
<a style=" font-size:120%;" href="javascript:setStatus(0,0);">setStatus(0,0) </a> - to disable progress callbacks <br />
<a style=" font-size:120%;" href="javascript:setStatus(0,1);">setStatus(0,1) </a> - to set progress interval to 1 second <br />
<form action="#" name="messageForm">
<textarea cols=40 rows=7 name="message" READONLY></textarea>
</form>
</body>
</html>