How Does the SMIL seq Element Work?
The <seq> (sequence) timing container in
Synchronized Multimedia Integration Language (SMIL) defines a timeline
where child elements play strictly one after another in chronological
order. Unlike parallel containers that trigger simultaneous playback,
the <seq> element establishes automatic temporal
dependencies between siblings, advancing playback only after each
preceding item concludes. Understanding how SMIL manages implicit start
times, active durations, and end conditions within a
<seq> container is fundamental for creating
structured multimedia playlists and presentations.
Core Mechanics of Sequential Playback
At its foundation, <seq> coordinates the playback
flow by evaluating the completion of each nested element. The first
child element begins playing immediately when the parent
<seq> container becomes active, unless an explicit
delay is configured.
Each subsequent child element’s implicit start time is tied directly to the active end of the element immediately preceding it. Once the current media element finishes its active duration—whether through intrinsic file duration or explicit SMIL timing attributes—the SMIL timing engine resolves the next sibling's start condition and initiates its playback.
Implicit vs. Explicit Start Times
In a standard parallel container (<par>), child
elements without explicit timing start at time zero relative to the
container. Within a <seq> container, the default
timing semantics change:
- Implicit Timing: If no
beginattribute is declared on a child element, itsbeginis implicitly defined asprev.end(the exact moment the preceding sibling finishes). - Positive Offsets: Specifying a positive offset such
as
begin="2s"introduces a pause or gap between the end of the previous item and the start of the current item. - Event-Based Overrides: If a child defines an explicit event or syncbase condition (for example, waiting for a user click), playback of that child halts until the condition is met, pausing the overall sequence progression.
Handling Element Duration and container End
The total duration of a <seq> container is
determined by the cumulative sum of the active durations of all its
children, including any explicit delays between them.
Several key timing attributes influence how the sequence completes:
durAttribute on Children: Explicitly settingdur="5s"on an image or text element defines its active duration, allowing static media to hold on screen before the sequence automatically steps forward.durAttribute on<seq>: Setting a hard duration on the<seq>container itself will force the entire sequence to terminate when that duration elapses, even if some children have not yet played.endsyncEvaluation: Because children play sequentially rather than concurrently, the defaultendsync="last"attribute naturally resolves when the final sequential child element terminates.repeatCountandrepeatDur: When repeating loops are applied to a<seq>container, the entire ordered list of media items resets and plays from the first child once the final child completes.