Playlist Containers

SMIL supports 3 container types

  1. Sequential
  2. Parallel
  3. Exclusive

Sequential Playlist

The sequential playlist is the simplest form of playlists in SMIL. In a sequential playlist, media objects are played in the order they are listed in the SMIL file. One media object starts playing after the one ends.

<seq repeatCount="indefinite"/>
	<video src="video1.mkv" />
	<img src="image.png" dur="5s" />
<seq/>
Loop a video and a JPG image indefinitely.

Another great feature of SMIL is the option to nest container.

<seq repeatCount="indefinite"/>
	<video src="video1.mkv" />
	<seq repeatCount="3"/>
		<img src="image1.jpg" dur="5s" />
		<img src="image2.jpg" dur="5s" />
	<seq/>
<seq/>
Plays the video and then the two image sequence 3 times. Then it repeats the entire sequence endlessly.

You can find a simple seq samples to study here, here, and here

Parallel Playlist

The SMIL parallel playlist is a list of media objects that start playback simultaneously. Illustration of using the parallel playlist for multi-zone effects are located in the section on Layout. Children of the parallel playlist can be specified to start at a specific time defined by the player's real-time clock. See section on trigger for details.

<par>
	<seq repeatCount="indefinite">
		<img src="pic1.jpg" dur="5s" />
		<img src="pic2.jpg" dur="5s" />
		<img src="pic3.jpg" dur="5s" />
	</seq>
	<audio src="music.mp3" repeatCount="indefinite" />
</par>
An image slide show with background music

The parallel schedule has two children: a sequential playlist containing 3 images, and a single audio media object. The sequential playlist and the audio object start simultaneously, like a slide show, while music plays in the background.

You can find a real world with a simple multiple screen layout par samples to study here

Exclusive Playlist

This is the most interesting, but also most complicated container. It allows only one of its children to play at the same time. The start of one media object causes the currently playing item to either pause or stop. The priorityClass tag further defines interrupt priorities and behavior (pause, defer, never, or stop) of media objects when interrupts occur. The starting of a media object may be triggered by an event such as a key press, mouse click, touch, or a time, as the following sample code illustrates.

The peer-attribute describes the interrupt behavior of the priorityClass children.

Stop behavior

Stop means, that a higher element stops the lower element.

<excl>
	<priorityClass peers="stop">
		<img src="0002.jpg" begin="1s" dur="1s" />
		<img src="0001.jpg" begin="0s" dur="10s" />
	</priorityClass>
</excl>
Image 1 start playing and will be interrupted by 2 after 1s and ends after another second

The attribute begin will be discussed during lesson trigger in more detail. You need to image a timeline. It starts on 0s with image 1 which should play 10s. But it will be interrupted by 001 after 1s because 1 has a higher priority in the priority class.

Peer default

<excl>
	<img src="0002.jpg" begin="1s" dur="1s" />
	<img src="0001.jpg" begin="0s" dur="10s" />
</excl>
Same results as above (stop)

You can skip the priorityClass-tags if you use only one priority. If you have two priorities, it is necessary to use the priorityClass two times; otherwise this is an error. As the default behavior for peer is stop, we get the same results as above.

A more complex real world excl sample to study the peer stop behavior

Pause behavior

Pause causes a higher element to pause the lower element. The paused element enters a waiting queue. After the higher element is finished, the lower element plays again for the remaining time of his duration.

<excl>
	<priorityClass peers="pause">
		<img src="0002.jpg" begin="1s" dur="1s" />
		<img src="0001.jpg" begin="0s" dur="10s" />
	</priorityClass>
</excl>
Image 1 will be interrupted by 2, but after that jumped back to 1 for 9s again

This timeline starts on 0s with image 001 and will again be interrupted by 001 after 1s because 1 has a higher priority in the priority class. But because we set pause as peer after the end of 002 it jumps back to 002 and play for rest time of 9s.

Study pause behavior

Defer behavior

Defer describes what happened when a lower element tries to interrupt a higher element. In this case, the lower element will take place in a waiting queue until the higher element finished.
<excl>
	<priorityClass peers="defer">
		<img src="0001.jpg" begin="0s" dur="10s" />
		<img src="0002.jpg" begin="1s" dur="2s" />
	</priorityClass>
</excl>
image 1 will play 10s and then 2s

This timeline starts on 0s with image 001 and after one second image 002 try to start. But as image 002 has a lower priority, it will enter in wait state. Nine seconds later when 001 is finished 002 starts to display for two seconds.

Study the defer behavior with this example

Never behavior

A lower element stops when it attempts to start during an active duration of his higher sibling.

<excl>
	<priorityClass peers="never">
		<img src="0001.jpg" begin="0s" dur="10s" />
		<img src="0002.jpg" begin="1s" dur="2s" />
	</priorityClass>
</excl>
Image 1 will play 10s. Image 2 will be ignored.

This timeline starts on 0s with image 001 and after one second lower prioritized image 002 try to start. In this case, nothing happens and image 002 is ignored.

Study the never behavior

The Higher Attribute

The attribute higher describe, what happened when an item from, a higher priorityClass group interrupts an element from a lower priorityClass. There are two options: pause (default) and stop.
<excl>
	<priorityClass">
		<img src="0001.jpg" begin="1s" dur="10s" />
	</priorityClass>
	<priorityClass higher="stop">
		<img src="0003.jpg" begin="0s" dur="2s" />
		<img src="0004.jpg" begin="2s" dur="2s" />
	</priorityClass>
</excl>
Image 3 will play 1s. Image 1 interrupts.

This is similar to the stop behavior in peer, but this control two or more groups of elements in priorityClass.

Study examples for Higher-attributes

The Lower Attribute

The attribute lower describe, what happened when an item of an element from a lower priorityClass try to interrupt a higher priority. There are two options: defer (default) and never.
<excl>
	<priorityClass lower="defer">
		<img src="0001.jpg" begin="0s" dur="10s" />
		<img src="0002.jpg" begin="10s" dur="1s" />
	</priorityClass>
	<priorityClass>
		<img src="0003.jpg" begin="1s" dur="2s" />
	</priorityClass>
</excl>
Image 1s plays 10, the image 2 for 1 second and then image 3 for 2s. Image 1 interrupts.

This is also similar to the defer behavior in peer. Image 1 starts, 3 attempts to interrupt, bus as in lower priority it moves to a waiting queue and starts player after the finish of image 2. The higher priority has a duration of 12 seconds.

Study examples for Lower-attributes

Generic Container Attributes

In this starter tutorial, the repeatCount attribute is relevant for playlist containers and media objects.

Repeat Count

The attribute repeatCounts controls how often the media or container can be repeated. There are two values possible:

  • indefinite: In this context, it means endless.
  • numeric value: A decimal integer number greater than 0. Some SMIL-player also supports floating-point numeric values like 2.5.