SMIL Media Element

SMIL uses media elements to describe content.

Media Element

The following media elements can be used to include media objects in SMIL documents:

Element Description Ver
<animation> Define animation. 1
<audio> Define audio clip. 1
<brush> Define brush. 1
<img> Define image. 1
<param> Define parameter. 1
<ref> Define general media reference. 1
<text> Define text. 1
<textstream> Define text stream. 1
<video> Define video. 1

Media Attribute

It is necessary to use the reference (URL) in the 'src' attribute to include each media object in the SMIL document. The 'src' attribute is the most commonly used attribute in media elements.

The 'type' attribute is used to define the media type. If the 'type' attribute is ignored, the application depends on the type information informed by the server. Developers should not rely on file extension names to define file types.

Attribute Description Ver
erase Define the behavior of the element after the timing is completed. 1
src Define the source of the media object. 1
type Define media type. 1

For a complete list of SMIL elements and attributes, please visit CodeW3C.com SMIL Reference Manual.

<animation> element

The <animation> element defines a reference to an animation object that is stored as a vector graphic or other types.

Do not confuse the <animation> element with the <animate> element. The <animation> element defines the animation object by reference. The <animate> element defines the animation display of other elements.

<audio> element

The <audio> element defines a reference to an audio object that is stored as recorded audio.

Example:

<html xmlns:t="urn:schemas-microsoft-com:time">
<head>
  <?import namespace="t" implementation="#default#time2">
</head>
<body>
<t:audio
src="liar.wav"
repeatCount="indefinite"
type="wav" />
</body>
</html>

Try It Yourself (TIY)

<brush> element

The <brush> element defines the fill color or fill pattern.

This element defines the coloring or pattern to be used as a substitute for the media object.

<img> element

The <img> element defines a reference to an image object that is stored in JPG or other image formats.

Example:

<img src="myimage.gif" type="GIF" />

<param> element

The <param> element defines parameters for any other media element.

Example:

<param name="color" value="red" />

The <ref> element

The <ref> element defines a reference to a general media element.

The <ref> element can be used when the media type is not well-defined.

The <text> element

The <text> element defines a reference to a text object that is stored as text.

The <textstream> element

The <textstream> element defines a reference to a text object that is stored as a text stream.

The <video> element

The <video> element defines a reference to a video object that is stored as a recorded video.

Example:

<html xmlns:t="urn:schemas-microsoft-com:time">
<head>
  <?import namespace="t" implementation="#default#time2">
</head>
<body>
<t:video
src="http://www.ananova.com/about/vap_windows_check.wmv"
repeatCount="indefinite"
type="wmv" />
</body>
</html>

Try It Yourself (TIY)