# <audio>

Description

Plays an audio file.

If the file cannot be played, the content of the `<audio>` element is played instead. Any content must be prompt markup, including text, speech markup, and/or other audio tags.

If the file cannot be found and played and there's no alternate content, the `<audio>` element is ignored.

Syntax

    <audio
        src="URI"
        expr="ECMAScript_Expression"
        fetchhint="prefetch" | "safe" | "stream"
        fetchtimeout="time_interval"
        maxage="integer"
        maxstale="integer"
        volume="integer from -9 to +9"
        offsetexpr="ECMAScript_Expression"
        lengthexpr="ECMAScript_Expression">
      child elements
    </audio>

Attributes

Attribute | Description
src | The URI specifying the location of the audio file. The URI can be one of the following formats: External audio file: URL of the audio file Local audio: `builtin:[path/]filename` (an audio file named `/usr/local/phoneweb/audio/[path/]filename` must exist on the IP Media Server platform) Optional. Exactly one of src or expr must be specified.
expr | An ECMAScript expression to be evaluated and used as the URI of the audio file, as documented under `src`, above; or an ECMAScript audio variable (such as the `name` associated with a previously filled `<record>`). If a specified `expr` evaluates to null, the `<audio>` element will be skipped, including its alternate content. Optional. Exactly one of src or expr must be specified.
fetchhint | Defines when the audio file should be fetched. Optional. prefetch - audio file may be downloaded when the page is loaded safe - only load the audio file when needed stream - allows audio streaming with HTTP. (See Limitations below.)
fetchtimeout | The length of time to wait for the audio file to be fetched before playing the alternate content. If alternate content is not specified or cannot be found, the behaviour will be as specified in the element description, above. Optional.
maxage | Indicates that this document is willing to use a cached copy of this audio file only while the age of the cached copy is less than or equal to the number of seconds specified by this attribute. Optional.
maxstale | Indicates that this document is willing to use a cached copy of this audio file that has exceeded its expiration time by as much as the number of seconds specified by this attribute. Optional.
volume | Increases or decreases the volume of the audio file by the number of dB. Specified as +dB or -dB: eg. "+2". Optional.
offsetexpr | An ECMAScript expression to be evaluated and used as the time offset at which to begin playing the audio file. Optional. (Defaults to 0.)
lengthexpr | An ECMAScript expression to be evaluated and used as the time length of the audio data to be played from the file. Optional. (Defaults to the length of referenced audio.)

Attribute Notes

- In standards compliance mode, using both `src` and `expr` will result in an `error.badfetch` event being thrown. If the `com.voicegenie.STRICTCONFORMANCE` property is set to `FALSE`, the value of `src` overrides `expr` if both are used.

Parents

<audio>, <block>, <catch>, <choice>, <enumerate>, <error>, <field>, <filled>, <foreach>, <help>, <if>, <initial>, <menu>, <noinput>, <nomatch>, <object>, <prompt>, <record>, <subdialog>, <transfer>, Speech Markup (SSML)

Children

<audio>, <enumerate>, <value>, Speech Markup (SSML), #PCDATA

extensions

- Added support for accessing builtin (local) audio resources.
- Added "stream" as value for `fetchhint` attribute.
- Added `volume` attribute.
- Added `offsetexpr` attribute.
- Added `lengthexpr` attribute.

Limitations/Restrictions

- Currently, `<desc>` and `<mark>` are not supported within SSML content in `<audio>`.
- If `fetchhint` is set to `stream`, the `offsetexpr` and `lengthexpr` will be ignored.
- If `fetchhint` is set to `stream`, the audio control features will not work.
- If `fetchhint` is set to `stream`, the entire prompt queue will block and not play until all the HTTP fetches have started for all the external audio files.

Example

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <block>
          Here is the recorded thank you message:
          <audio src="thankyou.vox">
             If you can hear this, thankyou.vox was not found.
          </audio>
        </block>
      </form>
    </vxml>