13.1 Summary of Changes for
SMIL 3.0

This section is informative

The facilities proposed in this module represent new functionality for
SMIL 3.0.

13.2 Introduction

This section is informative

This moduke defines an XML timing language that makes SMIL 3.0 element and
attribute timing control available to a wide range of other XML languages.
This language allows SMIL timing to be integrated in to a wide variety of
a-temporal languages, even when several such languages are combined in a
compound document. Because of its similarity with external style and
positioning descriptions in the cascading style sheet language CSS, this
functionality has been termed SMIL timesheets.

SMIL Timesheets can be seen as a temporal counterpart for CSS. Whereas CSS
defines the spatial layout of the document and formatting of the elements,
SMIL Timesheets specify which elements are active at a certain moment and
what their temporal scope is within a document. And as with CSS, SMIL
Timesheets can be reused in multiple documents, which can provide a common
temporal framework for multimedia presentations with different contents but
identical storylines. The document can be shown in a user agent even if the
SMIL Timesheets are not supported, since the contents and the layout are
still governed by the document itself. Of course, the temporal aspect of the
document is then lost, since all the elements are active all the time.

The par Parallel time
container. All the children of the par are activated simultaneously and the
duration of the container, if not specified with the dur attribute will be
the same as with the child that has the longest duration of all the children
of the container. This element is similar to the par element specified in the
SMIL 3.0 Timing and Synchronization Module.

The seq Sequential time
container. The children of seq are displayed sequentially so, that next child
is activated as soon as the previous child finishes. The first child is
activated when the parent container starts. Only one child of seq can be
shown simultaneously. Total duration of the seq is either specified by the
dur attribute, or if it is omitted, by the sum of durations of all the
children of the element. If a child of the container has an indefinite
duration, the following children will never be activated and the duration of
the container will be indefinite. This element is similar to the seq element
specified in the SMIL 3.0 Timing and
Synchronization Module.

The excl Exclusive time
container. The exclusive time container can have only one child active at a
certain moment, similarly to the sequential time container. The excl doesn't
provide any other synchronization or scheduling to its children, it only
assures that no multiple children are active simultaneously. When a child
starts according to its begin attribute, the container deactivates any other
child that may be active.

Unlike the other time containers, excl has implicitely indefinite
duration, since there is no defined situation when the container should end.
The par ends when all the children has stopped, and the seq when the last
child finishes. Neither approach is applicable to the excl, since the
temporal order of the children is unknown.

The excl is a special case of the seq where the container's duration is
set to indefinite and all the children have indefinite or interactive begin
times. It is also a simplified version of the excl element defined in the SMIL 3.0 Timing and Synchronization Module.

The item target element
reference element. The item element implements the actual connection between
the timesheet and the document. It can reference a media element or a set of
elements by the element's tag, id or class; the syntax and processing is
similar to the CSS selector syntax.

The select attribute links the timesheet to the document. The
attribute follows the same syntax and processing as the CSS selectors,
so that the elements can be referenced by their name, id or class, or a
more complex combination of the selectors. If the attribute targets
multiple elements in the document, item controls all of them. The
attribute value can also specify a comma separated list of
selectors.

The prefetch controls the loading of the resources needed by the
elements referenced by the item element. Some resources, like audio,
video and big images, can be quite big in size and fetching them on the
fly while the timesheet is already running could skew the timing of the
whole timesheet. With the prefetch attribute the author can mark
certain elements and their resources to be prefetched to the memory
before the timesheet is started. This way the resources can be shown
precisely at the specified moment of time. If the attribute is omitted
or set to false, the resources are loaded just before the item is
activated. When the attribute is set to true the resources are loaded
into the memory before the timesheet and the timeline is started.

The begin and dur attributes can contain
references to DOM events [DOM2Events]. DOM events can be triggered by user
interaction or by some other event in the document. Events are divided into
two distinct groups, internal events and user events.

Internal
events

Internal events are dispatched from within the timesheets. They can be
used by other elements in the timesheet to create relations between different
parts of the timeline. The events specified are begin event, which
is dispatched when an element starts and end event, which is
dispatched when element stops.

User events

User events are triggered by the actions that user makes. A typical
example is that the user clicks on a link in the document, and thus a
DOMActivate event is dispatched [DOM2Events].

Event
semantics

A timesheet element is set to listen to a certain event by specifying the
event's target and type by either begin or dur
attribute. When specified by the begin attribute, an inactive or
active but not yet started element will be started when it receives the
specified event. This may involve the activation and starting of the parent
elements as well, which can require some special scheduling to be done on the
upper level of the DOM tree. Consider Figure 2
as an example. At a certain time, the item with the id "1" is
active. This means that the second child of the seq (i.e., the
par element) can't be active. Next, the item number
"3" gets an event, which it is set to listen to by the begin
attribute. To activate itself, the element must first inform its parent that
it is going to start. The parent (i.e., the par element) is also
inactive, so it informs its parent of the activation. The parent
seq element then stops the excl element and its
children to allow the par element to start, and par
element then activates its children according to the definition.

Figure 2: the affect of event on a timesheet.

When the element is specified to stop according to an event, it doesn't
cause that much processing in the timesheet. The element informs its parent
that it has stopped and parent then decides what should happen next. Of
course, some other element could be waiting to start according to the
end event from the particular element.

Additional
events

There are also four additional events that are specified for the
seq element. They are select-next,
select-prev, select-first and select-last. These
are used to select a certain child of the seq element, which
facilitates the creation of presentations where the user can have control of
the progression of the timeline, for example, a slide show. It should be
possible to add later more additional events to any other elements of the
timesheet.

The timing semantics of the timesheets is based on the semantics of the
SMIL timing model [SMIL21-timing], although it has been simplified a bit.
This may cause the timing model not to be as powerful in expression of timing
relations as the SMIL's, but it should be more approachable to the
authors.

The base time, or the syncbase of a timesheet element is the
moment when the element is activated by its parent. Activating an element
doesn't necessary make the referenced media element visible. Rather, it sets
the time moment "0s", to which the element's attributes are compared. Thus,
it's not possible to specify a negative value to the begin
attribute, since it would mean that the element was supposed to start in the
past when it was still inactive. The timesheet element can activate itself,
according to the events it is set to listen. The self-activation of the
element bubbles upwards in the DOM so that the parent elements do the
necessary actions to allow the activation of the correct child.

The syncbase of the child elements of a time container is depended on the
type of the container. The children of par and excl
elements have the starting time of their parent as their syncbase. The
children of the seq element consider the end time of preceding
child as their syncbase. This time is resolved only at the moment the
preceding child ends.

Figure 1
shows a simple example of the semantics of a timesheet. A parallel time
container has two children, which are item elements referencing
two media elements. When the par is started, it activates both
its children with the current time as their syncbase. The media elements
referenced by the children are not activated yet. At time moment 1s,
the media element item1 is activated, according to the begin value
of the referencing timesheet element. At 2s, the item2 is
activated. At 3s, the duration of item1 runs out, so it is
stopped and the corresponding timesheet element deactivates itself. At
4s, the parent container stops according to its duration attribute,
stopping all of its active children.

Figure 1: Timeline of
a Timesheets

The duration of an element is primarily defined by the dur
attribute. If the element is not stopped prematurely, due to an event or
scheduling of its parent, the dur attribute tells the overall
duration of the element. The element will not stop until this duration has
passed, and will not stay active longer that this duration. The value of the
dur attribute will prevail.

when the sum of the durations of the children of a time container
extends the value of the attribute

when the implicit duration of the media elements, like audio or video
is longer that the specified duration

when the repeat attribute of the timesheets extends the
duration of a media element to be longer than the specified duration

If the duration is not set, the duration of an element depends on the type
of the referenced elements, or the durations of the children. The timesheet
items can reference to static and dynamic elements in the document. Static
elements don't have implicit durations, and the implicit duration of an
item element referencing a static element is indefinite. Dynamic
elements have their own durations, which will be also used as the duration of
the timesheet element. The duration of the timecontainer depends on the
durations and activations of its children. The seq and
par elements stay active until all of their children have
stopped. The implicit duration of the excl is always
indefinite.

Next example is a picture show with captions for each image shown
simultaneously. The new image is shown every five seconds, which dispatches a
begin event that is listened by the corresponding item under the
exclusive time container. The exclusive time container takes care that there
can be only one caption active at a certain time. If the selection of an
image is changed later, there is no need to touch the selection of
captions.

This is an extended version of the previous example. In
this version, the user has full control of progression of the show. When
document is loaded, there's a welcome page that suggest the user to click on
a link to start the show. Showing the pictures is not done automatically this
time, instead the user must click on links "Next" or "Previous" to navigate
through the show. At any time, the user can also jump to the beginning or the
end of the presentation.

The start and end pages listen to DOMActivate event, which is
dispatched when a user clicks a link. The forward/backward navigation can't
use the same event, the seq element listens to events
select-next and select-prev instead (cf. Section Additional
events). In this example, the XForms [XFORMS] is used to dispatch
the events.

Since SMIL Timesheets only describes the temporal dimension of the
document, it must be integrated with a host language's layout system. It can
be integrated to CSS based layout by affecting the CSS properties of media
elements. For instance, the CSS display property controls whether the element
is displayed or not. The SMIL Timesheets processor sets the CSS pseudo-class
timed-inactive for the media element when the element should not be visible
based on the timesheet. Then, with a default rule for the pseudo-class, the
CSS property display is set to "none" to the non-visible media element. The
pseudo-class overrides element's original display property and the element
becomes invisible. When the media element should become visible, the
implementation removes the pseudo-class from the element, thus restoring the
original value.

The default style sheet should contain a declaration with the pseudo-class
called timed-inactive that is used to control the visibility of the media
elements:

:timed-inactive { display: none ! important;}

Additionally, the language is extended by defining a class attribute for
the item element. It can be used to change style properties of the elements
from the timesheet. For example, the author could specify the red background
of an element to be changed to blue at some time. This is done by setting the
value of class attribute to reference a CSS pseudo-class that is used in the
style sheet of the document. The author doesn't have to add the same document
element with the same content multiple times with different style properties,
but instead only define a pseudo-class for each property change and control
them from the timesheet.