SPEED Attribute | speed Property

Internet Development Index

Sets or retrieves the playback speed of an element relative to its parent time container.

Syntax

HTML<ELEMENT SPEED = fSpeed... >
Scriptingobject.speed(speed) [ = fSpeed ]

Possible Values

fSpeed Floating-point that specifies or receives the playback speed of an element relative to its parent time container.
floatElement playback speed is multiplied by this value.
1.0Default. Element playback speed is not modified.

The property is read/write. The property has a default value of 1.0.

Remarks

Element playback speed is relative to its parent time container at run time. For example, if an element's parent time container and the element itself both have the speed property set to 0.5, the element plays back at 25% of its normal playback speed. That is, the parent plays at 50% and the child plays at 50% of the parent speed, yielding a 25% playback speed for the child. You can obtain an element's run-time speed by accessing the speed property exposed by the currTimeState object.

Negative values cause video elements to freeze on the last frame.

A value of zero is considered invalid. The media will play at the default of 1.0 if speed is set to 0.

Some media players are not able to play at the requested speed value. If the media player cannot keep up, an onoutofsync event occurs and the requested speed value is treated as invalid. As a result, the media will play back at normal speed. The rest of the timeline progresses at the specified speed value, even if the media player cannot keep up.

The speed value affects the length of the active duration of an element. If an object's speed is increased, the active duration will be shorter than the value specified in the DUR attribute. If the object is slowed, the active duration will be longer than the value specified in the DUR attribute.

Example

This example shows how to use the speed property to set the playback speed of a timeline. The time container is set to begin at zero seconds, with a duration of five seconds and speed set to 0.5 (or half of its normal speed). The child element is set to begin one second after its parent, with a duration of one second and speed set to 0.5 (half of its normal speed). The parent's speed of 0.5 multiplied by the child's speed of 0.5 equals a speed of 0.25, or 25%. Therefore, the child element plays at 25% of its normal speed, or four times its duration, yielding a total duration of four seconds. The parent's timeline plays at only 50% of its normal speed, or twice its duration, yielding a total duration of 10 seconds.

<HTML XMLNS:t="urn:schemas-microsoft-com:time">
<HEAD>
<?IMPORT namespace="t" implementation="#default#time2">
<STYLE>
.time{ behavior: url(#default#time2);}
</STYLE>
</HEAD>
<BODY>
<B>Document Timer:</B>
<SPAN id="Timer1" class="time" dur=".01" repeatCount="indefinite" fill="hold"
onrepeat="innerText=parseInt(document.body.currTimeState.activeTime);">0</SPAN>
<BR><BR>
<B>Time Container Timer:</B>
<SPAN id="Timer2" class="time" dur=".01" repeatCount="indefinite" fill="hold"
onrepeat="innerText=parseInt(t1.currTimeState.activeTime);">0</SPAN>
<BR><BR>
<t:excl ID="t1" begin="0; b1.onclick;" dur="5" speed="0.5">
<DIV ID="div1" CLASS="time" begin="1" DUR="1" speed="0.5"
style="color:blue;font-size:1in">Hello World!</DIV>
</t:excl>
<BR>
<BUTTON id="b1">Click to restart</BUTTON>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is defined in Synchronized Multimedia Integration Language (SMIL) 2.0 Non-Microsoft link.

Applies To

t:TRANSITIONFILTER, t:ANIMATE, t:ANIMATECOLOR, t:ANIMATEMOTION, t:ANIMATION, t:AUDIO, t:IMG, t:MEDIA, t:PAR, t:REF, t:SEQ, time2, t:VIDEO

See Also

Introduction to HTML+TIME