3.2 audio
Element type |
audio |
Attributes |
expr (2.0) | fetchhint | fetchtimeout | maxage (2.0) | maxstale (2.0) | src |
Parents |
audio | block | catch | choice | emphasis | enumerate | error | field | filled | help | if | initial | menu | noinput | nomatch | object | paragraph | prompt | prosody | record | sentence | subdialog | transfer | voice |
Children |
PCDATA | audio | break | emphasis | enumerate | mark | paragraph | phoneme | prosody | say-as | sentence | value | voice |
Description |
Instructs the interpreter to play the specified audio. If the audio resource is unavailable, the children elements will be rendered using text-to-speech. |
DTD
<!ELEMENT audio (%audio; | %tts;)* > <!ATTLIST audio src %uri; #IMPLIED expr %expression; #IMPLIED %cache.attrs; >
Language model
Attributes
-
expr : expression
-
An ECMAScript expression that evaluates to a URI pointing to the audio resource to play. If this expression evaluates to null, this audio element is skipped. If the src attribute is defined, the expr attribute is ignored.
-
fetchhint : (prefetch | safe)
-
Indicates whether the interpreter may prefetch the resource specified by this element. A value of prefetch indicates the resource may be retrieved at the time the containing VoiceXML document is retrieved. A value of safe indicates that the resource specified by this element should not be prefetched, but should instead be retrieved at the time that the interpreter executes this element.
-
fetchtimeout : duration
-
The interval to wait for the content to be returned before throwing an error.badfetch event. If this attribute is not specified, the interpreter derives a value from the most locally scoped fetchtimeout property.
-
maxage : integer
-
Indicates the maximum allowable age of the fetched document in seconds. If the cached copy is older than the specified maxage, a new copy will be fetched when the interpreter executes this element. If this attribute is not specified, the interpreter derives a value from the most locally scoped maxage property. If no maxstale attribute is defined and it is impossible to fetch a new copy on the content the interpreter will throw an error.badfetch instead of using stale content.
-
maxstale : integer
-
Indicates that the interpreter may use stale content for this element as long as its age is no older than maxage plus the value of maxstale in seconds. If this attribute is not specified, the interpreter derives a value from the most locally scoped maxstale property.
-
src : uri
-
Indicates where to find the audio resource to play.
Children
-
audible and tts elements
-
To be rendered using text-to-speech in the case when the audio resource specified with either the src attribute or the expr attribute is unavailable.
Examples
Example 3-2 Rendering a TTS message if playing an audio stream fails
<?xml version="1.0" encoding="iso-8859-1"?> <vxml version="2.0"> <form id="audiotest"> <block> <audio src="https://205.188.234.65:8006"> I'm sorry. The audio stream is not available today. </audio> </block> </form> </vxml>