How Does SMIL syncMaster Synchronize Streams?

In Synchronized Multimedia Integration Language (SMIL), the syncMaster="true" attribute designates a specific media stream as the primary clock source for a synchronized presentation. When parallel media elements such as audio, video, and text captions play simultaneously, hardware timing differences, network latency, and decoding overhead can cause streams to drift out of sync. Assigning syncMaster="true" forces the SMIL playback engine to tie the presentation's timeline directly to that designated master element, ensuring that all dependent sibling elements adjust their playback to stay strictly aligned.

The Challenge of Multi-Stream Media Drift

When multiple continuous media objects run inside a parallel container (<par>), each file typically possesses its own internal playback clock and decoding pipeline. Over time, slight deviations occur:

Without a master clock, the playback engine either allows elements to drift independently or relies on a generic presentation clock that may not reflect whether a specific media stream has stalled or skipped.

How syncMaster Establishes the Master Clock

When you assign syncMaster="true" to a continuous media element—most commonly the main audio or video track—it becomes the authoritative reference for its parent container.

<par>
  <video src="presentation.mp4" syncMaster="true" />
  <audio src="commentary.mp3" syncBehavior="locked" />
  <textstream src="subtitles.rt" syncBehavior="locked" />
</par>

Under this configuration:

  1. Master Dictates Time: The playback engine polls the time code directly from the designated master element rather than relying on an abstract internal timer.
  2. Buffer Synchronization: If the sync master encounters a buffer underflow and pauses playback, the entire synchronization context pauses. Dependent streams freeze on their current frame or silence until the master resumes.
  3. Seek Coordination: When a user seeks or skips forward within the sync master, all synchronized child elements immediately adjust their positions to match the master's new timestamp.
  4. Speed and Rate Matching: If the master element changes playback rate (such as 1.5x fast-forward), dependent elements scale their playback rates accordingly to preserve alignment.

Relationship with syncBehavior and syncTolerance

The syncMaster attribute works in tandem with two other SMIL synchronization attributes: syncBehavior and syncTolerance.

syncBehavior Settings

The syncBehavior attribute defines how strictly dependent elements must follow the timeline:

syncTolerance Thresholds

The syncTolerance attribute specifies an acceptable time window (e.g., syncTolerance="0.2s") within which a stream is allowed to deviate before the engine forces a resynchronization. This prevents jarring micro-adjustments and stuttering caused by minor, imperceptible frame delays.

Precedence and Scope Rules

SMIL enforces strict constraints on master designation to prevent conflicting timing instructions: