Freigeben über


Resume Method

  Microsoft Speech Technologies Homepage

Resumes playback of the current subqueue after a pause.

PromptQueue.Resume()

Remarks

The Resume method has no effect if playback has not been paused. Note that the Resume method is a synchronous method that returns 0 if the subqueue is successfully resumed, or -1 if it is not.

Example

The following code demonstrates the use of the Resume 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 | Pause Method | Start Method