How Does the endsync Attribute Work in SMIL?

The endsync attribute in Synchronized Multimedia Integration Language (SMIL) controls the active duration and synchronization semantics of a parallel container (<par>). By defining whether the container finishes when its first child ends, when all children finish, or when a specific designated child completes, endsync resolves how concurrent media tracks with differing durations interact within a single timeline.

Purpose of the endsync Attribute

In SMIL, a <par> element groups multiple multimedia elements—such as audio, video, text, and animations—to play concurrently. Because different media items frequently have distinct intrinsic or declared durations, the container requires explicit rules to govern its endpoint.

When an explicit container duration (dur) or fixed container end condition (end) is not supplied, the endsync attribute dictates which child element's implicit or explicit end triggers the end of the entire parallel container. Once the selected condition is met, the container concludes, and any currently playing sibling elements inside that container are forced to terminate.

Supported Values and Semantics

The SMIL specification defines several standard values for the endsync attribute:

Interaction with Child Durations

The endsync evaluation takes place in real time during presentation playback:

<par endsync="first">
  <video id="mainVideo" src="clip.mp4" dur="10s" />
  <audio id="bgMusic" src="music.mp3" dur="30s" />
</par>

In this example, the audio track has a declared duration of 30 seconds, but the video lasts only 10 seconds. Because endsync is set to first, the conclusion of mainVideo at the 10-second mark causes the entire <par> block to end, halting bgMusic prematurely at 10 seconds.

Conversely, referencing an explicit ID allows critical elements to drive timeline progression:

<par endsync="masterAudio">
  <video src="ambient.mp4" repeatCount="indefinite" />
  <audio id="masterAudio" src="narration.mp3" dur="12s" />
</par>

Even though the ambient background video is configured to repeat indefinitely, the container terminates as soon as masterAudio finishes its 12-second playback.

Precedence and Edge Cases

The behavior of endsync is subject to container-level constraints: