Last reviewed: 3/23/2024 11:59:11 AM
<audio>
An <audio> element plays an audio clip within a prompt.
Syntax
<audio expr="expression"
fetchhint="fetchtype"
fetchtimeout="secondsormilliseconds"
maxage="seconds"
maxstale="seconds"
src="uri" />
Attributes
expr
An ECMAScript expression which determines the source of the audio to be played. The expression may be either a reference to audio previously recorded with the <record> element or evaluate to the URI of an audio resource to fetch.
fetchhint
Defines when the interpreter context should retrieve content from the server. prefetch indicates a file may be downloaded when the page is loaded. safe indicates a file that should only be downloaded when actually needed. If not specified, a value derived from the innermost relevant fetchhint property is used. The default value is the audiofetchhint property.
Fetch Type | Description |
---|---|
prefetch | Indicates a file may be downloaded when the page is loaded. |
safe | Indicates a file that should only be downloaded when actually needed. |
fetchtimeout
The interval to wait for the content to be returned before throwing an error.badfetch event. The value is a Time Designation. The default value is the fetchtimeout property.
maxage
Indicates that the document is willing to use content whose age is no greater than the specified time in seconds. The default value is the audiomaxage property.
maxstale
Indicates that the document is willing to use content that has exceeded its expiration time. The default value is the audiomaxstale property.
src
The URI of the audio prompt.
Children
<audio>
Parents
<audio>, <block>, <catch>, <enumerate>, <error>, <field>, <filled>, <help>, <if>, <initial>, <menu>, <noinput>, <nomatch>, <object>, <prompt>, <record>, <subdialog>, and <transfer>.
Variables
none
Example
The following example illustrates using example elements.
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml
http://www.w3.org/TR/voicexml20/vxml.xsd"
version="2.0">
<meta name="author" content="VoiceXML 2.0"/>
<meta name="maintainer" content="productsupport@chant.net"/>
<form>
<prompt>
Your recorded greeting is
<audio expr="greeting"/>
To rerecord, press 1.
To keep it, press pound.
To return to the main menu press star M.
To exit press star, star X.
</prompt>
</form>
</vxml>
Version Information
Supported in: VoiceXML 1.0, VoiceXML 2.0, and VoiceXML 2.1.