Pause Method
Pauses playback of the current subqueue without flushing the audio or otherwise affecting the subqueue.
PromptQueue.Pause()
Remarks
The Pause method has no effect if playback is already paused or stopped. Note that the Pause method is a synchronous method that returns 0 if the subqueue is successfully paused, or -1 if it is not. While playback is paused, subsequent calls to the Start method of either the prompt element or the PromptQueue element have the expected result of delimiting subqueues. Playback remains paused, however, until the Resume method is called.
Example
The following code demonstrates the use of the Pause method.
<HTML xmlns:SALT="http://www.saltforum.org/2002/SALT">
<HEAD>
<script language="JScript">
<![CDATA[
var intPromptCounter = 0;
var strLogText = "!*!";
PromptQueue.onempty = OnPromptQueueEmpty;
PromptQueue.onerror = OnPromptQueueError;
function fnSmexStartMonitoring(SmexID) {
...
}
function fnSmexOnReceive() {
...
}
function fnPromptInfo(PromptId) {
...
}
function fnPromptError() {
...
}
function fnOutput(strText) {
LogMessage("INFORMATIONAL", strLogText + strText);
}
function fnLogError(strErrorText) {
LogMessage("ERROR", strLogText + strErrorText);
}
function OnPromptQueueEmpty() {
fnOutput("PromptQueue playback has completed, the status is: " + PromptQueue.status);
fnFinal();
}
function OnPromptQueueError() {
fnLogError("A PromptQueue error has occurred, the status is: " + PromptQueue.status);
fnFinal();
}
function OnPageLoad() {
fnOutput("The page was loaded.");
fnSmexStartMonitoring(MySmex);
}
function OnPromptComplete() {
fnOutput("Prompt playback has completed for PromptQueue element number " + (++intPromptCounter));
}
function OnPageUnload() {
fnOutput("The page was unloaded.");
}
function fnCallConnected() {
MyPrompt.Queue("This text is queued first.");
MyPrompt.Queue("This text is queued second.");
MyPrompt.Queue("This text is queued third.");
fnOutput("Starting the PromptQueue.");
PromptQueue.Start();
PromptQueue.Pause();
MySmex.timer = 2000;
}
function fnLocalSmexTimeout() {
fnOutput("The timer has expired.");
PromptQueue.Resume();
}
function fnFinal() {
fnPromptInfo(MyPrompt);
fnSmexHangUp(MySmex);
}
]]>
</script>
</HEAD>
<body onload = "OnPageLoad()" onunload = "OnPageUnload()">
<SALT:prompt id = "MyPrompt" onerror = "fnPromptError()" oncomplete = "OnPromptComplete()"/>
<SALT:smex id = "MySmex" timer = "0" onreceive = "fnSmexOnReceive(MySmex)" ontimeout="fnLocalSmexTimeout()"/>
</body>
See Also
promptqueue Object | prompt Element | Resume Method | Start Method