What Does the SMIL dur Attribute Do?
In Synchronized Multimedia Integration Language (SMIL), the
dur (duration) attribute specifies the simple duration of
an element, defining exactly how long that media or animation element
should play or remain active on its own timeline. By controlling the
explicit playback length of elements like audio, video, images, or text
streams, dur acts as the fundamental timing mechanism for
synchronizing multi-track multimedia presentations.
Defining the Simple Duration
The primary role of the dur attribute is to establish
the simple duration of an element, distinct from its active duration or
total timeline duration. When a media element is triggered (via a
begin time), dur tells the SMIL rendering
engine how long to present that item before transitioning, ending, or
repeating.
In a SMIL timing graph:
- Explicit Duration: Setting
dur="10s"forces the element to play for exactly 10 seconds. - Continuous Media: For video or audio files that
possess an intrinsic length (such as a 30-second clip), setting a
smaller
dur(e.g.,dur="15s") truncates playback, while a largerdurmay freeze on the final frame or continue playing silence, depending on media configuration. - Discrete Media: For static assets with no intrinsic
duration, such as text strings or still images,
durprovides the necessary playback length to display the asset within a timed layout.
Supported Attribute Values
The dur attribute accepts several distinct value types
depending on the author's timing needs:
- Clock Values: Specific time values written in
hours, minutes, seconds, or milliseconds (e.g.,
dur="5s",dur="01:30",dur="250ms"). - "indefinite": Specifies that the element has an
unbounded duration and will play continuously until terminated by an
external event, a parent container boundary, or an explicit
endcondition. - "media": Explicitly directs the engine to use the intrinsic duration of the referenced media file. If applied to static media without intrinsic length, the duration resolves to indefinite.
Interaction with Containers and Timing Attributes
The dur attribute interacts directly with parent timing
containers—such as <par> (parallel) and
<seq> (sequential)—as well as other timing attributes
like begin, end, and
repeatCount.
- Sequential Execution (
<seq>): In a<seq>container, thedurvalue dictates exactly when the subsequent child element starts. The next item begins immediately after the current item's simple duration finishes. - Parallel Execution (
<par>): In a<par>container, elements with differentdurvalues run concurrently, allowing tracks of varying lengths (e.g., background music lastingdur="60s"paired with an image carousel where each image hasdur="5s") to synchronize along a shared master timeline. - Overrides with
end: If an explicitendattribute condition occurs beforedurelapses, the element terminates early. Conversely, ifdurelapses before theendcondition, the element ends at the duration limit unless extended by repetition parameters.