Share via


PromptQueue Object

  Microsoft Speech Technologies Homepage

Controls prompt playback. PromptQueue is only supported on Telephony Application Services.

Remarks

The PromptQueue is a browser object that is only accessible using a script language. The PromptQueue object is automatically created by those browsers that support it. It has no markup element, and therefore, cannot be created using Speech Application Language Tags (SALT).

The PromptQueue is provided as a browser object for two reasons:

  1. The PromptQueue maintains a central object for playback control. The asynchronous nature of the occurrence of the prompt element Queue method means that with multiple queued prompts, the speech application cannot know which prompt is currently being played back, and therefore which prompt to Pause, Stop, or Resume when necessary.
  2. The PromptQueue object allows playback to continue across page loading and unloading. This is because PromptQueue is not an element of any single page. For Telephony Application Services, PromptQueue is a global object. For other scenarios, PromptQueue object is a child of the window object rather than a child of any specific page.

The PromptQueue object holds one or more prompt subqueues. The subqueues are initiated using the Start method either on the PromptQueue object or on an individual prompt element. A new prompt subqueue is initiated using the prompt element's Queue method either when PromptQueue is empty, or after a Start method call, once the prompt is being played back. In other words, each set of prompt elements queued and followed by a Start method call is considered to be a single subqueue and no subqueue is played back until a Start method call is made.

The PromptQueue element consists of the following members:

Properties Description
status Indicates the success or failure of the most recent subqueue operation. Read-only.
Methods  
Change Changes speed and/or volume of prompt playback in all subqueues.
Flush Flushes the current subqueue buffer.
Pause Pauses playback of the current subqueue without flushing the audio or otherwise affecting the subqueue.
Resume Resumes playback of the current subqueue after a pause.
Start Schedules an open subqueue of prompts for playback.
Stop Stops playback of the current subqueue and flushes the subqueue buffer.
Events  
onempty Occurs when the last prompt in the subqueue has finished playback.
onerror Occurs when a serious or fatal error is encountered during the playback process.

Example

The following code demonstrates the use of the PromptQueue object.

<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  <body>
    <form id="form1" action="nextpage.html">
      <input type="button" onclick="transition();" value="next page" />
    </form>

    <salt:prompt id="transitionPrompt">
      Let's go to the next page!
    </salt:prompt>

    <script>
      function transition() {
        transitionPrompt.Queue();
        window.PromptQueue.Start();
        form1.submit();
      }
    </script>
  </body>
</html>

See Also

prompt Element