Basic Schedule

From open-smil
Jump to: navigation, search

Basic Schedule

Timing and Synchronization

SMIL Timing defines elements and attributes to coordinate and synchronize the presentation of media over time. The term media covers a broad range, including discrete media types such as still images, a web site, as well as continuous media types that are intrinsically time-based, such as video, audio.

Synchronization elements support common timing use-cases:

Sequential playlist <seq>

<seq> plays the child elements one after another. Media objects will be played in order when this element is used.

Example:

Play 5 images in a sequence and display 15 seconds for each image. dur is a Synchronization element attributes and "15s" is a simple duration. Please refer to Clock value for the simple duration format.
<seq>
  <img src="01.jpg" region="zone1" dur="15s"/>
  <img src="02.jpg" region="zone1" dur="15s"/>
  <img src="03.jpg" region="zone1" dur="15s"/>
  <img src="04.jpg" region="zone1" dur="15s"/>
  <img src="05.jpg" region="zone1" dur="15s"/>
</seq>

For children of a sequence, the only legal value for begin attribute is a (single) non-negative offset value. The default begin value is "0". None of the following begin values may be used in the children element of a sequence:

disallowed begin-values for children of <seq>: ( syncbase-value | wallclock-sync-value | accesskey-value)
<seq>
  <img src="01.jpg" region="zone1" dur="15s"/>
  <img src="02.jpg" region="zone1" begin="5s" dur="15s"/>            <!-- OK. begin with 5 seconds offset after 01.jpg -->
  <img src="03.jpg" region="zone1" begin="accesskey(1)" dur="15s"/>  <!-- Fail! It shall not assign a accesskey-value to the child of <seq> element -->
  <img src="04.jpg" region="zone1" dur="15s"/>
  <img src="05.jpg" region="zone1" dur="15s"/>
</seq>

Parallel playlist <par>

<par> plays child elements as a group (allowing "parallel" playback). All child element of the same <par> that will be played at the same time.

Example:

<par>
  <img src="01.jpg" region="zone1"/>
  <video src="02.mp4" region="zone2"/>
</par>
Image "01.jpg" and video "02.mp4" are played at the same time.

Clock value

Syntax:

  • Full clock values ::= Hours ":" Minutes ":" Seconds("." Fraction)?
Example: 02:30:03 = 2 hours, 30 minutes and 3 seconds
  • Partial clock value ::= Minutes ":" Seconds ("." Fraction)?
Example: 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds
  • Timecount values ::= Timecount ("." Fraction)? ("h" | "min" | "s" | "ms")?
Example:

3.2h = 3.2 hours = 3 hours and 12 minutes 45min = 45 minutes 30s = 30 seconds 5ms = 5 milliseconds

12.467 = 12 seconds and 467 milliseconds

Synchronization element attributes

begin

begin defines when an element will become active. These value types are supported in begin attribute:

  • Offset-value:

The begin time offset of a media object, children of a synchronization element can only specify a non-negative offset value for begin.

<seq>
  <!-- When 01.jpg is end, 02.jpg will delay 2 seconds and then play 15 seconds. -->
  <img src="01.jpg" region="zone1" dur="15s"/>
  <img src="02.jpg" region="zone1" begin="2s" dur="15s"/>
</seq>
  • Syncbase-value:

The begin time which will be synchronized with another element's begin or end time.

Syntax:

Syncbase-value  ::= ( Syncbase-element "." Time-symbol | Syncbase-element "." Time-symbol ("+|-") Clock-value )

Syncbase-element ::= Id-value

Time-symbol  ::= "begin" | "end"

<par>
  <!-- audio1.mp3 will start when video1.mp4 is finish and 5 seconds past. -->
  <video xml:id="v1" src="video1.mp4" region="zone1"/>
  <audio xml:id="a1" begin="v1.end + 5s" src="audio1.mp3"/>
</par>
  • Accesskey-value:

Begin the playback of an element when a key pressed.

Syntax:

Accesskey-value  ::= ( "accesskey(" Char ")" | "accesskey(" Char ")" ("+|-") Clock-value )

<par>
  <!-- tour_audio shall play when key '1' is pressed. -->
  <audio xml:id="tour_audio" src="01.mp3" begin="accesskey(1)"/>
  <img xml:id="picture1" src="img/01.jpg" region="img8" dur="indefinite" fit="fill"/>
</par>
  • Wallclock-sync-value:

Set begin time of a media object with the real-world clock time.

Syntax:

  • Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (e.g. 1997-07-16T19:20+01:00)
  • Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (e.g. 1997-07-16T19:20:30+01:00)
  • Hours, minutes and seconds:
hh:mm:ss_ (e.g. 08:00)

Note that the "T" appears literally in the string, to indicate the beginning of the time element, as specified in [ISO8601].

<par>
  <audio xml:id="tour_audio" src="audio1.mp3" begin="wallclock(08:00)"/> <!-- specifies a begin at 8 in the morning -->
  <img xml:id="picture1" src="img/01.jpg" region="img8" dur="indefinite" fit="fill"/>
</par>

end

end defines when an element will become inactive. These value types are supported in end attribute:

  • Offset-value:

The end time offset of a media object, children of a synchronization element can only specify a non-negative offset value for end.

<seq>
  <!-- The end offset time shall refer to parent element <par>, so the total duration shall be 3 seconds. (5s - 2s = 3s)  -->
  <img src="img/pic1.jpg" region="mainRegion" fit="fill" begin="2s" end="5s"/>
</seq>
  • Syncbase-value:

The end time which will be synchronized with another element's begin or end time.

Syntax:

Syncbase-value  ::= ( Syncbase-element "." Time-symbol | Syncbase-element "." Time-symbol ("+|-") Clock-value )

Syncbase-element ::= Id-value

Time-symbol  ::= "begin" | "end"

<par>
  <video xml:id="v1" src="video1.mp4" region="mainRegion" fit="fill"/>
  <audio xml:id="a1" src="audio1.mp3" end="v1.end"/>      <!-- audio is end when v1 became inactive -->
</par>
  • Accesskey-value:

End the playback of an element when a key pressed.

Syntax:

Accesskey-value  ::= ( "accesskey(" Char ")" | "accesskey(" Char ")" ("+|-") Clock-value )

<par>
  <img src="img/pic1.jpg" region="RegionTop" fit="fill" end="accesskey(a)"/> <!-- Display until key 'a' is pressed -->
  <img src="img/pic2.jpg" region="RegionBottom" fit="fill" end="accesskey(b)"/> <!-- Display until key 'b' is pressed -->
</par>
  • Wallclock-sync-value:

Set end time of a media object with the real-world clock time.

Syntax:

  • Complete date plus hours and minutes:

YYYY-MM-DDThh:mmTZD (e.g. 1997-07-16T19:20+01:00)

  • Complete date plus hours, minutes and seconds:

YYYY-MM-DDThh:mm:ssTZD (e.g. 1997-07-16T19:20:30+01:00)

  • Hours, minutes and seconds:

hh:mm:ss_ (e.g. 08:00) Note that the "T" appears literally in the string, to indicate the beginning of the time element, as specified in [ISO8601].

<par>
  <audio xml:id="tour_audio" src="audio1.mp3" end="wallclock(09:00)"/> <!-- specifies a end time at 9 in the morning -->
  <img xml:id="picture1" src="img/01.jpg" region="img8" dur="indefinite" fit="fill"/>
</par>

dur

dur defines the display duration of a media object. If dur attribute is not defined in the media tag, image will be display with 0.1 second as default duration. Video and audio media will keep playing until its media duration is ended. The list of attribute value:

  • Clock-value: Specifies the length of the simple duration, measured in element active time. Value must be greater than 0.
  • "indefinite": Specifies the simple duration as indefinite.
<seq>
  <!-- 01.jpg will be displayed 10 seconds before video 02.mp4 start playing. -->
  <img src="01.jpg" region="zone1" dur="10s"/>
  <video src="02.mp4" region="zone1"/>
</seq>

repeatCount

The repeat count of the element, it implies that "how many times to repeat". The repeat times will be indefinite if the repeatCount value is set to "indefinite".

<!-- Play seq synchronization element with 3 times. -->
<seq repeatCount="3">
  <img src="01.jpg" region="zone1" dur="10s"/>
  <img src="02.jpg" region="zone1" dur="10s"/>
  <img src="03.jpg" region="zone1" dur="10s"/>
</seq>

repeatDur

The repeat time of the element, it implies "how long to repeat".

<!-- Play seq synchronization element and repeat it in 30 seconds. -->
<seq repeatDur="30s">
  <img src="01.jpg" region="zone1" dur="5s"/>
  <img src="02.jpg" region="zone1" dur="5s"/>
  <img src="03.jpg" region="zone1" dur="5s"/>
</seq>

A basic schedule example

Example:

An audio tracks will be played along with images (in parallel). There are 5 images in the playlist and each of them will be displayed individually, it will iterate to the next image every 30 seconds. Both image and audio playlist will be played repeatedly for indefinite times.

<?xml version="1.0"?>
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
<head>
  <layout>
    <root-layout width="1920" height="1080"/>
    <region xml:id="main" left="0" top="0" width="1920" height="1080"/>
    <region xml:id="audio_track"/>
  </layout>
</head>
<body>
  <par>
    <seq repeatCount="indefinite">
      <audio region="audio_track" begin="0" src="sun.mp3"/>
      <audio region="audio_track" begin="0" src="star.mp3"/>
      <audio region="audio_track" begin="0" src="moon.mp3"/>
      <audio region="audio_track" begin="0" src="earth.mp3"/>
    </seq>
    <seq repeatCount="indefinite">
      <img src="01.jpg" region="main" dur="30s"/>
      <img src="02.jpg" region="main" dur="30s"/>
      <img src="03.jpg" region="main" dur="30s"/>
      <img src="04.jpg" region="main" dur="30s"/>
      <img src="05.jpg" region="main" dur="30s"/>
    </seq>
  </par>
</body>
</smil>

Related