<media>

Plays the media file at the specified location.

Syntax

<media
    src = "URI"
    expr = "CDATA"
    fetchhint = "{prefetch | safe}"
    fetchtimeout = "CDATA"
    maxage = "CDATA"
    maxstale = "CDATA"
    offset = "CDATA"
    offsetexpr = "CDATA"
    type = "CDATA"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

expr

CDATA

no

NA

ECMAScript expression that evaluates to the URI (location) of the media file. Programmable Media Platform proprietary. Use the v_ovl_def parameter following the media file to specify:

  • a URI (in http:// or file:/// format) to an XML file that defines a text overlay or image overlay.

  • an XML string that defines a text overlay or image overlay inline.

fetchhint

{prefetch | safe}

no

NA

Specifies when the VoiceXML Interpreter context should retrieve content from the server. Valid values:

  • prefetch = Fetch the resource when the page is loaded.

  • safe = Fetch the resource when it is specifically called by the application.

fetchtimeout

CDATA

no

NA

Time interval to wait for the content to be returned before throwing an error.badfetch event. Use s for seconds (for example, 1s) and ms for milliseconds (for example, 1ms).

maxage

CDATA

no

NA

Maximum acceptable age, in seconds, of a resource being fetched from the cache. Setting maxage to 0 means that a cached version is never considered fresh.

maxstale

CDATA

no

NA

Maximum acceptable staleness, in seconds, of the resource being fetched, if the fetched resource is cached and expired.

offset

CDATA

no

NA

The offset (in s or ms) at which to play the media file.

This attribute is supported for:

  • HTTP or local files that reference a 3GP file

  • HTTP or local audio-only files

  • Audio-only files streamed by an RTSP server

  • 3GP files streamed by an RTSP server

The behavior of the offset attribute for HTTP or local files that reference a 3GP file differs, depending on the presence of a sync point table and a matching I-frame. For information, see the Details.

Note: The offset attribute is not supported for live RTSP presentations.

offsetexpr

CDATA

no

NA

ECMAScript expression that evaluates to the offset. This can be used in conjunction with the lastresult$.bargeintime variable to let the application play a media file from the point at which the user barged in, and not have to start from the beginning again. This attribute is especially useful for long media files.

src

CDATA

no

NA

URI of the media file. Use the v_ovl_def parameter following the media file to specify:

  • a URI (in http:// or file:/// format) to an XML file that defines a text overlay or image overlay.

  • an XML string that defines a text overlay or image overlay inline.

type

CDATA

no

NA

Preferred media type of the requested resource. This can differ from the actual media type of the resource. The VoiceXML Interpreter currently ignores this attribute, determining the media type during HTTP content negotiation or content introspection.

Details

This element can be used with the <par> element to provide parallel playback of different media types.

In this implementation, the <audio> and <media> elements are completely equivalent, with the exception that <media> can specify a type of application/ssml+xml, omitting the src and expr attributes and enclosing a complete SSML document as its child content. This content is not treated as alternate content.

The behavior of the offset attribute works as follows for HTTP or local files that reference 3GP files:

If the Referenced 3GP File...

And...

Then the VoiceXML Interpreter...

Contains a sync point table.

There is an I-frame that corresponds to the specified offset.

Plays the file from that I-frame.

 

The specified offset does not match an I-frame.

Plays the file from the next I-frame after the specified offset.

 

There is no next I-frame.

Does not play the file.

Does not contain a sync point table.

NA

Ignores the offset attribute and plays the file from the beginning.

Parents

<audio>, <block>, <catch>, <choice>, <enumerate>, <error>, <field>, <filled>, <foreach>, <help>, <if>, <initial>, <media>, <menu>, <noinput>, <nomatch>, <object>, <prompt>, <record>, <subdialog>, <transfer>

Children

<audio>, <break>, <desc>, <emphasis>, <enumerate>, <p>, <mark>, <media>, <phoneme>, <s><prosody>, <say-as>, <speak>, <sub>, <value>, <voice>

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <var name="num_messages" expr="3"/>
    <form>
        <block>
            <prompt>
                <par>
                    <media src="rtsp://example.org/avatar.3gp"/>  <!-- Video only -->
                    <media type="application/ssml+xml">

                        <speak version="1.0" xml:lang="en-GB">
                            Welcome to your Video Mail account!
                                You have <value expr="num_messages"/> messages.
                        </speak>
                    </media>
                </par>
            </prompt>
        </block>
    </form>
</vxml>

 

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <form>
        <block>
            <prompt>
                <media type=”video/3gpp” src=”http://www.example.com/generator”/>
            </prompt>
        </block>
    </form>
</vxml>

See Also

<audio>, <par>, <prompt>