Advance schedule

From open-smil
Jump to: navigation, search

Advance schedule

prefetch

prefetch enables device to load media contents (and save it to the cache) before the media content is played. It enhances user experience by shortening the waiting time in between media contents. Wthout using prefetch, a longer waiting time may take place due to large media files and limited bandwidth.


Example:

Use prefetch to download a video when an image is being displayed.

<?xml version="1.0"?>
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
  <body>
    <par>
      <img src="loading.jpg" end="dl.end"/> <!-- show loading image during prefetch, and stop it when prefetch finish -->
      <par xml:id="dl"> <!-- parallelize prefetching necessary files -->
        <prefetch src="video1.mp4"/>
        <prefetch src="video2.mp4"/>
      </par>
    </par>
    <seq repeatCount="indefinite">
      <video src="video1.mp4"/>
      <video src="video2.mp4"/>
    </seq>
  </body>
</smil>

Exclusive playlist <excl>

excl defines a time container with semantics based upon par, but with the additional constraint that only one child element may play at any given time. With the excl time container, common use cases that were either difficult, or impossible, to author are now easier and possible to create. The excl time container is used to define a mutually exclusive set of clips, and to describe pausing and resuming behaviors among these clips.

Example:

Play 2 videos alternately and uses begin in excl to change background image as different video.

<?xml version="1.0"?>
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
  <head>
    <layout>
      <root-layout xml:id="root-layout" width="1920" height="1080"/>
      <region xml:id="region1" width="100%" height="100%"/>
    </layout>
  </head>
  <body>
    <par>
      <excl dur="indefinite">
        <img src="pic1.jpg" z-index="1" region="region1" begin="id1.begin"/>
        <img src="pic4.jpg" z-index="1" region="region1" begin="id2.begin"/>
      </excl>
      <seq repeatCount="indefinite">
        <video xml:id="id1" src="video1.mp4" z-index="2" region="region1"/>
        <video xml:id="id2" src="video2.mp4" z-index="2" region="region1"/>
      </seq>
    </par>
  </body>
</smil>


Example:

Use accesskey in *excl* to change background image on demand. At beginning, there is no background image. When user presses the "A" key, "pic1.jpg" will be shown. "pic2.jpg" will be shown when user presses the "B" key.

<?xml version="1.0"?>
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
  <head>
    <layout>
      <root-layout xml:id="root-layout" width="1920" height="1080"/>
      <region xml:id="region1" width="100%" height="100%"/>
    </layout>
  </head>
  <body>
    <par>
      <excl dur="indefinite">
        <img src="pic1.jpg" z-index="1" region="region1" begin="accesskey(a)"/>
        <img src="pic4.jpg" z-index="1" region="region1" begin="accesskey(b)"/>
      </excl>
      <seq repeatCount="indefinite">
        <video src="video1.mp4" z-index="2" region="region1"/>
        <video src="video2.mp4" z-index="2" region="region1"/>
      </seq>
    </par>
  </body>
</smil>

priorityClass

Using priority classes to control the pausing behavior of children of the excl allows the author to group content into categories of content, and then to describe rules for how each category will interrupt or be interrupted by other categories. Attributes of the new grouping element priorityClass describe the intended interactions.

Each priorityClass element describes a group of children, and the behavior of those children when interrupted by other time-children of the excl. The behavior is described in terms of peers, and higher and lower priority elements. Peers are those elements within the same priorityClass element.

When one element within the excl begins (or would normally begin) while another is already active, several behaviors may result. The active element may be paused or stopped, or the interrupting element may be deferred, or simply blocked from beginning.

"peers" attribute

peers Description
stop If a child begins while another child element is active, the active element is simply stopped
This is default for peers
defer If a child element attempts to (i.e. would normally) begin while another child element is active, the new (interrupting) element is deferred until the active element completes its active duration.
never If a child element attempts to (i.e. would normally) begin while another child element is active, the new (interrupting) element is prevented from beginning. The begin of the new (interrupting) element is ignored
  • peers="stop"

Example: This example has the same result as the excl example (Play 2 videos alternately and uses begin in excl to change background image as different video).

<?xml version="1.0"?>
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
  <head>
    <layout>
      <root-layout xml:id="root-layout" width="1920" height="1080"/>
      <region xml:id="region1" width="100%" height="100%"/>
    </layout>
  </head>
  <body>
    <par>
      <excl dur="indefinite">
        <priorityClass peers="stop"> <!-- new added line -->
          <img src="pic1.jpg" z-index="1" region="region1" begin="id1.begin"/>
          <img src="pic4.jpg" z-index="1" region="region1" begin="id2.begin"/>
        </priorityClass> <!-- new added line -->
      </excl>
      <seq repeatCount="indefinite">
        <video xml:id="id1" src="video1.mp4" z-index="2" region="region1"/>
        <video xml:id="id2" src="video2.mp4" z-index="2" region="region1"/>
      </seq>
    </par>
  </body>
</smil>
  • peers="defer"

Example: defer is used for peers attribute. When pic1 is playing, pic4 will not interrupt pic1, and pic1 will deferred to play when pic4 is finished.

<excl dur="indefinite">
  <priorityClass peers="defer">
    <img src="pic1.jpg" z-index="1" region="region1" begin="id1.begin"/>
    <img src="pic4.jpg" z-index="1" region="region1" begin="id2.begin"/>
  </priorityClass>
</excl>
  • peers="never"

Example: never is used for peers attribute. When pic1 is playing, pic4 will never be played.

<excl dur="indefinite">
  <priorityClass peers="never">
    <img src="pic1.jpg" begin="id1.begin"/>
    <img src="pic4.jpg" begin="id2.begin"/>
  </priorityClass>
</excl>

"higher" and "lower" attribute

  • higher controls how elements with higher priority will interrupt child elements of this priorityClass.
Legal values for the attribute are:
higher Description
stop If a higher priority element begins while a child element of this priorityClass is active, the active child element is simply stopped.
This is default for higher
  • lower controls how elements defined with lower priority will interrupt child elements of this priorityClass.
Legal values for the attribute are:
lower Description
defer If a lower priority element attempts to (would normally) begin while a child element of this priorityClass is active, the new (interrupting) element is deferred until the active element completes its active duration.
The rules for adding the element to the queue are described below.
This is the default for the lower attribute.
never If a lower priority element attempts to begin while a child element of this priorityClass is active, the new (interrupting) element is prevented from beginning. The begin of the new (interrupting) element is ignored, and it is not added to the queue.

Example:

  • During the playback of "video1", the begin command to "video2" and "video3" will not be executed.
  • During the playback of "video2", the begin command to "video3" will be defer. But, if "video1" is triggered, it will interrupt the playback of "video2".
  • During the playback of "video3", if "video1" or "video2" is triggered, it will interrupt the playback of "video3".
<?xml version="1.0"?>
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
  <head>
    <layout>
      <root-layout xml:id="root-layout" width="1920" height="1080"/>
      <region xml:id="region1" width="100%" height="100%"/>
    </layout>
  </head>
  <body>
    <par>
      <excl dur="indefinite">
        <priorityClass lower="never">
          <video src="video1.mp4" region="region1" begin="accesskey(a)"/>
        </priorityClass>
        <priorityClass lower="defer" higher="stop">
          <video src="video2.mp4" region="region1" begin="accesskey(b)"/>
        </priorityClass>
        <priorityClass higher="stop">
          <video src="video3.mp4" region="region1" begin="accesskey(c)"/>
        </priorityClass>
      </excl>
    </par>
  </body>
</smil>

Wallclock

The wallclock module of SMIL using ISO 8601 standard Date, Time, and Durations. For digital signage, wallclock is a crucial component that allows precise scheduling of media playback. 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].

Date/time Events

  • Trigger event once from midnight of February 1, 2016
wallclock(2016-02-01)

Example: Trigger event once from midnight to next midmight of February 1, 2016

<excl repeatCount="indefinite">
  <priorityClass> 
    <seq id="id1"
      begin="wallclock(2016-02-01)"
      end="wallclock(2016-02-02)">
        <img src="media/1.png" region="region1"/>
    </seq>
    <seq id="intervalNoShow" begin="id1.end" end="id1.begin">
      <!--null seq to replace id1 when id1 is inactive-->
    </seq>
  </priorityClass>
</excl>
  • Trigger event once from 8:00 of February 1, 2016
wallclock(2016-02-01T08:00)

Example: Trigger once event from 8:00 to 20:00 of February 1, 2016

<excl repeatCount="indefinite">
  <priorityClass> 
    <seq id="id1"
      begin="wallclock(2016-02-01T08:00)"
      end="wallclock(2016-02-01T20:00)">
        <img src="media/1.png" region="region1"/>
    </seq>
    <seq id="intervalNoShow" begin="id1.end" end="id1.begin">
      <!--null seq to replace id1 when id1 is inactive-->
    </seq>
  </priorityClass>
</excl>

Day of Week Events

  • On first Saturday (+w6) after February 1, 2016 (equivalent to February 6, 2016)
wallclock(2016-02-01+w6)

Example: Every Saturday 8:00 to 20:00 event start from 8:00 February 6, 2016

<excl repeatCount="indefinite">
  <priorityClass> 
    <seq id="id1"
      begin="wallclock(R/2016-02-01T08:00+w6/P1W)"
      end="wallclock(R/2016-02-01T20:00+w6/P1W)">
        <img src="media/1.png" region="region1"/>
    </seq>
    <seq id="intervalNoShow" begin="id1.end" end="id1.begin">
      <!--null seq to replace id1 when id1 is inactive-->
    </seq>
  </priorityClass>
</excl>
  • On last Sunday (-w7) before February 1, 2016 (equivalent to January 31, 2016)
wallclock(2016-02-01-w7)

Example: Every Sunday 8:00 to 20:00 event start from 8:00 January 31, 2016

<excl repeatCount="indefinite">
  <priorityClass> 
    <seq id="id1"
      begin="wallclock(R/2016-02-01T08:00-w7/P1W)"
      end="wallclock(R/2016-02-01T20:00-w7/P1W)">
        <img src="media/1.png" region="region1"/>
    </seq>
    <seq id="intervalNoShow" begin="id1.end" end="id1.begin">
      <!--null seq to replace id1 when id1 is inactive1-->
    </seq>
  </priorityClass>
</excl>

Repeated Date/time Events

  • Repeating intervals

Repeating intervals are formed by adding "R[n]/" to the beginning of an interval expression, where R is used as the letter itself and [n] is replaced by the number of repetitions. Leaving out the value for [n] means an unbounded number of repetitions.

Rnn/<interval>
R/<interval>
wallclock(R/2016-02-01/P1W)
  • Durations

Durations are represented by the format P[n]Y[n]M[n]DT[n]H[n]M or P[n]W.

PnYnMnDTnHnM
PnW
P<date>T

In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required, but the maximum number of digits for each element should be agreed to by the communicating parties. The capital letters P, Y, M, W, D, T, H, and M are designators for each of the date and time elements and are not replaced.

  • Parameter
Parameter Description
P The duration designator (for period) placed at the start of the duration representation.
Y The year designator that follows the value for the number of years.
M The month designator that follows the value for the number of months.
W The week designator that follows the value for the number of weeks.
D The day designator that follows the value for the number of days.
T The time designator that precedes the time components of the representation.
H The hour designator that follows the value for the number of hours.
M The minute designator that follows the value for the number of minutes.
  • Start event at each of the first 4 Mondays (R4/.../P1W) 08:00 from February 1, 2016
wallclock(R4/2016-02-01T08:00/P1W)

Example: Trigger repeated event at each of the first 4 Mondays from 8:00 to 20:00 of February 1, 2016

event will be triggered from 8:00 to 20:00 every week at 2016/2/1, 2016/2/8, etc.
<excl repeatCount="indefinite">
  <priorityClass> 
    <seq id="id1"
      begin="wallclock(R4/2016-02-01T08:00/P1W)"
      end="wallclock(R4/2016-02-01T20:00/P1W)">
        <img src="media/1.png" region="region1"/>
    </seq>
    <seq id="intervalNoShow" begin="id1.end" end="id1.begin">
      <!--null seq to replace id1 when id1 is inactive-->
    </seq>
  </priorityClass>
</excl>
  • On the top of every hour starting 8AM on February 1, 2016
wallclock(R/2016-02-01T08:00/PT1H)

Example: Trigger hourly event from 8:00 of February 1, 2016, every event duration is 10 minutes.

event will be triggered everyday and every hour at 00:00~00:10, 01:00~01:10, 02:00~02:10, and so on from 8:00 of February 1, 2016
<excl repeatCount="indefinite">
  <priorityClass> 
    <seq id="id1"
      begin="wallclock(R/2016-02-01T08:00/PT1H)"
      end="wallclock(R/2016-02-01T08:10/PT1H)">
        <img src="media/1.png" region="region1"/>
    </seq>
    <seq id="intervalNoShow" begin="id1.end" end="id1.begin">
      <!--null seq to replace id1 when id1 is inactive-->
    </seq>
  </priorityClass>
</excl>
  • Multiple wallclock combinations

Example: Weekly repeated 2 time slots: "Mon-Fri" & "Sat-Sun" start from 8:00 of February 1, 2016

<excl repeatCount="indefinite">
  <priorityClass> 
    <seq id="idweekday"
      begin="wallclock(R/2016-02-01T08:00+w1/P1W);wallclock(R/2016-02-01T08:00+w2/P1W);wallclock(R/2016-02-01T08:00+w3/P1W);wallclock(R/2016-02-01T08:00+w4/P1W);wallclock(R/2016-02-01T08:00+w5/P1W)"
      end="wallclock(R/2016-02-01T20:00+w1/P1W);wallclock(R/2016-02-01T20:00+w2/P1W);wallclock(R/2016-02-01T20:00+w3/P1W);wallclock(R/2016-02-01T20:00+w4/P1W);wallclock(R/2016-02-01T20:00+w5/P1W)">
        <img src="media/1.png" region="region1"/>
    </seq>
    <seq id="idweekend"
      begin="wallclock(R/2016-02-01T08:00+w6/P1W);wallclock(R/2016-02-01T08:00+w7/P1W);"
      end="wallclock(R/2016-02-01T08:10+w6/P1W);wallclock(R/2016-02-01T08:00+w7/P1W);">
        <img src="media/2.png" region="region1"/>
    </seq>
    <seq id="intervalNoShow1" begin="idweekday.end" end="idweekday.begin">
      <!--null seq to replace idweekday when idweekday is inactive-->
    </seq>
    <seq id="intervalNoShow2" begin="idweekend.end" end="idweekend.begin">
      <!--null seq to replace idweekend when idweekend is inactive-->
    </seq>
  </priorityClass>
</excl>

Related