How Does the <par> Container Run Elements in SMIL?

The <par> (parallel) element in Synchronized Multimedia Integration Language (SMIL) is a timing container designed to execute multiple child media elements concurrently rather than sequentially. While its default behavior initiates all child elements at the exact same moment the container begins, developers can control start times, offsets, end conditions, and synchronization rules through specific timing attributes. This article explores the internal timing model of <par>, detailing how child elements begin, how container duration is determined, and how dynamic synchronization affects playback.

The Basic Execution Model

In SMIL, the <par> element defines a temporal grouping where the default start time of each child element is zero relative to the container's start. When the <par> container is activated, the playback engine immediately evaluates all child elements (such as audio, video, images, or text) and begins executing them simultaneously.

Unlike the <seq> (sequence) container, which waits for the previous child to finish before triggering the next, <par> allows media streams with overlapping durations to play together in parallel.

<par>
  <video src="presentation.mp4" />
  <audio src="voiceover.mp3" />
  <img src="slides.png" />
</par>

In this basic configuration, the video, audio track, and slide image all initialize and display at the same instant.

Controlling Child Start Times and Offsets

Although child elements inside <par> share a common timeline origin, they do not have to start simultaneously. The begin attribute allows individual children to specify temporal offsets or event-based triggers relative to the parent container or sibling elements.

Container End Behavior and the endsync Attribute

A critical aspect of <par> execution is determining when the container itself ends. The overall duration of <par> can be explicitly defined using the dur attribute or determined implicitly by the lifespan of its children via the endsync attribute.

The endsync attribute accepts several values that dictate termination:

Synchronization and Drift Management

When executing continuous media types like separate audio and video tracks in parallel, clock drift can cause streams to fall out of sync. SMIL manages this through the syncBehavior and syncTolerance attributes applied to <par> children:

Through these combined timing primitives, the <par> container provides a robust framework for orchestrating complex, multi-layered multimedia presentations.