This Section defines the SMIL content control module. This module contains elements and attributes which provide for runtime content choices and optimized content delivery. Since these elements and attributes are defined in a module, designers of other markup languages can reuse the functionality in the SMIL content control module when they need to include media content control in their language. Conversely, language designers incorporating other SMIL modules do not need to include the content module if other content control functionality is already present.
This module is broken up into 2 levels. Level 0 contains Content Selection and system test attributes and Level 1 contains user defined test attributes and presentation optimization elements and attributes. It is the intent that the levels build on each other so profiles implementing Level 1 should also implement Level 0.
SMIL 1.0 provides a "test-attribute" mechanism to process an element only when certain conditions are true, for example when the client has a certain screen-size. SMIL 1.0 also provides the switch element for expressing that a set of document parts are alternatives, and that the first one fulfilling certain conditions should be chosen. This is useful to express that different language versions of an audio file are available, and to have the client select one of them. This version includes these features and extends them by supporting new system test-attributes, as well as the ability to customize a presentation to an individual viewer by providing author defined, user selected test-attributes.
The switch element allows an author to specify a set of alternative elements from which only the first acceptable element should be chosen. An element is acceptable if the language allows the element as a child of a switch, the media-type can be decoded (if the element declares media), and all of the test-attributes of the element evaluate to true. When integrating content control into a profile, the profile must specify what constitutes an "acceptable element."
An element is selected as follows: the player evaluates the elements in the order in which they occur in the switch element. The first acceptable element is selected at the exclusion of all other elements within the switch.
Thus, authors should order the alternatives from the most desirable to the least desirable. Furthermore, authors should place a relatively fail-safe alternative as the last item in the switch so that at least one item within the switch is chosen (unless this is explicitly not desired). Implementations should NOT arbitrarily pick an object within a switch when test-attributes for all child elements fail.
Note that some network protocols, e.g. HTTP and RTSP, support content-negotiation, which may be an alternative to using the switch element in some cases.
This attribute is introduced for future extensibility of SMIL. Note that the hyphenated attribute name from SMIL 1.0 has been deprecated in favor of using the current SMIL camelCase convention. The deprecated SMIL 1.0 name is shown in parentheses after the preferred name.
If the value of the skipContent attribute is true,
and one of the cases above apply, the content of the element is ignored.
If the value is false, the content of the
element is processed.
The default value for skipContent is true.
It is the responsibility of the language profile to specify which elements have skipContent attributes to enable this expansion mechanism.
This specification defines a list of test attributes that can be added to language elements, as allowed by the language designer. In SMIL 1.0, these elements are synchronization and media elements. Conceptually, these attributes represent Boolean tests. When any of the test attributes specified for an element evaluates to false, the element carrying this attribute is ignored.
Within the list below, the concept of "user preference" may show up. User preferences are usually set by the playback engine using a preferences dialog box, but this specification does not place any restrictions on how such preferences are communicated from the user to the SMIL player.
This version of SMIL defines the following test attributes. Note that some hyphenated test attribute names from SMIL 1.0 have been deprecated in favor of names using the current SMIL camelCase convention. For these, the deprecated SMIL 1.0 name is shown in parentheses after the preferred name.
It is implementation dependent when system or user test attributes are evaluated. Attributes may be evaluated multiple times. Dynamic reevaluation is allowed but not required.
The prefix rule simply allows the use of prefix tags if this is the case.
Implementation note: When making the choice of linguistic preference available to the user, implementers should take into account the fact that users are not familiar with the details of language matching as described above, and should provide appropriate guidance. As an example, users may assume that on selecting "en-gb", they will be served any kind of English document if British English is not available. The user interface for setting user preferences should guide the user to add "en" to get the best matching behavior.
Multiple languages MAY be listed for content that is intended for multiple audiences. For example, a rendition of the "Treaty of Waitangi", presented simultaneously in the original Maori and English versions, would call for:
<audio src="foo.rm" systemLanguage="mi, en"/>
However, just because multiple languages are present within the object on which the systemLanguage test attribute is placed, this does not mean that it is intended for multiple linguistic audiences. An example would be a beginner's language primer, such as "A First Lesson in Latin," which is clearly intended to be used by an English-literate audience. In this case, the systemLanguage test attribute should only include "en".
Authoring note: Authors should realize that if several alternative language objects are enclosed in a "switch", and none of them matches, this may lead to situations such as a video being shown without any audio track. It is thus recommended to include a "catch-all" choice at the end of such a switch which is acceptable in all cases.
These values come from the _PR_SI_SYSNAME constants defined by the mozilla project http://www.mozilla.org
These values come from the _PR_SI_ARCHITECTURE constants defined by the mozilla project http://www.mozilla.org
In a common scenario, implementations may wish to allow for selection via a systemBitrate attribute on elements. The media player evaluates each of the "choices" (elements within the switch) one at a time, looking for an acceptable bitrate given the known characteristics of the link between the media player and media server.
0 ... 1 <par> 2 <text .../> 3 <switch> 4 <par systemBitrate="40000"> 5 ... 6 </par> 7 <par systemBitrate="24000"> 8 ... 9 </par> 10 <par systemBitrate="10000"> 11 ... 12 </par> 13 </switch> 14 </par> 15 ...
The elements within the switch may be any combination of elements. For instance, one could merely be specifying an alternate audio track:
0 ... 1 <switch> 2 <audio src="joe-audio-better-quality" systemBitrate="16000" /> 3 <audio src="joe-audio" systemBitrate="8000" /> 4 </switch> 5 ...
In the following example, an audio resource is available both in French and in English. Based on the user's preferred language, the player can choose one of these audio resources.
0 ... 1 <switch> 2 <audio src="joe-audio-french" systemLanguage="fr"/> 3 <audio src="joe-audio-english" systemLanguage="en"/> 4 </switch> 5 ...
In the following example, the presentation contains alternative parts designed for screens with different resolutions and bit-depths. Depending on the particular characteristics of the screen, the player can choose one of the alternatives.
0 ... 1 <par> 2 <text .../> 3 <switch> 4 <par systemScreenSize="1280X1024" systemScreenDepth="16"> 5 ... 6 </par> 7 <par systemScreenSize="640X480" systemScreenDepth="32"> 8 ... 9 </par> 10 <par systemScreenSize="640X480" systemScreenDepth="16"> 11 ... 12 </par> 13 </switch> 14 </par> 15 ...
In the following example, captions are shown only if the user wants captions on.
0 ... 1 <seq> 2 <par> 3 <audio src="audio.rm"/> 4 <video src="video.rm"/> 5 <textstream src="stockticker.rt"/> 6 <textstream src="closed-caps.rt" systemCaptions="on"/> 7 </par> 8 </seq> 9 ...
In the following example, a French-language movie is available with English, German, and Dutch overdub and subtitle tracks. The following SMIL segment expresses this, and switches on the alternatives that the user prefers.
0 ... 1 <par> 2 <switch> 3 <audio src="movie-aud-en.rm" systemLanguage="en" 4 systemOverdubOrSubtitle="overdub"/> 5 <audio src="movie-aud-de.rm" systemLanguage="de" 6 systemOverdubOrSubtitle="overdub"/> 7 <audio src="movie-aud-nl.rm" systemLanguage="nl" 8 systemOverdubOrSubtitle="overdub"/> 9 <!-- French for everyone else --> 10 <audio src="movie-aud-fr.rm"/> 11 </switch> 12 <video src="movie-vid.rm"/> 13 <switch> 14 <textstream src="movie-sub-en.rt" systemLanguage="en" 15 systemOverdubOrSubtitle="subtitle"/> 16 <textstream src="movie-sub-de.rt" systemLanguage="de" 17 systemOverdubOrSubtitle="subtitle"/> 18 <textstream src="movie-sub-nl.rt" systemLanguage="nl" 19 systemOverdubOrSubtitle="subtitle"/> 20 <!-- French captions for those that really want them --> 21 <textstream src="movie-caps-fr.rt" systemCaptions="on"/> 22 </switch> 23 </par> 24 ...
When using a switch element for selection only the first element for which all test attributes evaluate to true is selected. This can lead to complex nesting of switch elements to get the desired combinations. Additionally, only the combinations that the author created can be selected. To allow more flexibility in element selection, this version of SMIL allows test attributes outside of the switch element.
An example of how a switch might be used to control the alternatives that could accompany a piece of video in a presentation would be:
0 ... 1 <par> 2 <video src="anchor.mpg" ... /> 3 <switch> 4 <audio src="dutch.aiff" systemLanguage="DU" systemOverdubOrSubtitle="overdub" ... /> 5 <audio src="english.aiff" systemLanguage="EN" systemOverdubOrSubtitle="overdub"... /> 6 <text src="dutch.html" systemLanguage="DU" systemOverdubOrSubtitle="subtitle"... /> 7 <text src="english.html" systemLanguage="EN" systemOverdubOrSubtitle="subtitle"... /> 8 </switch> 9 </par> 10 ...
This fragment (which is pseudo-SMIL for clarity) says that a video is played in parallel with one of: Dutch audio, English audio, Dutch text, or English text. SMIL does not specify the selection mechanism, only a way of specifying the alternatives. If the user wanted Dutch audio and English text, this possibility must have been considered at authoring time.
Here is the same example with in-line test attributes:
0 ... 1 <par> 2 <video src="anchor.mpg" ... /> 3 <audio src="dutch.aiff" systemLanguage="DU" systemOverdubOrSubtitle="overdub" ... /> 4 <audio src="english.aiff" systemLanguage="EN" systemOverdubOrSubtitle="overdub"... /> 5 <text src="dutch.html" systemLanguage="DU" systemOverdubOrSubtitle="subtitle"... /> 6 <text src="english.html" systemLanguage="EN" systemOverdubOrSubtitle="subtitle"... /> 7 </par> 8 ...
This example says: a video is accompanied by four other data objects, all of which are (logically) shown in parallel. This is, of course, exactly what happens: all five do run in parallel, but it could be that only the video and one audio stream are actually selected by the user (or a user agent) to be rendered during the presentation. At author time you know which logical streams are available, but it is only at runtime that you know which combination of all potentially available stream actually meet the user's needs. Logically, the alternatives indicated by the in-line construct could be represented as a set of switch statements, although the resulting switch could become explosive in size. Use of an in-line test mechanism significantly simplifies the specification of adaptive content in the case that many independent alternatives exist.
Attributes and elements specified as part of Level 1 are profile specific features. Inclusion of a Level 1 feature requires support for Level 0 features.
The provision of switch-based and in-line system test attributes provides a selection mechanism based on general system attributes. This version of SMIL extends this notion with the definition of user test attributes. User test attributes allow presentation authors to define their own test attributes for use in a specific document.
The elements used to provide user group functionality are:
It would be good to have more explanation of this last use.
In addition to the userAttributes and uGroup elements, this module provides a uGroup attribute that can be applied to content requiring selection.
The following example shows how user groups can be applied within a SMIL document:
1 <smil> 2 <head> 3 <layout> 4 <!-- define projection regions --> 5 </layout> 6 userAttributes 7 <uGroup id="nl_aud" uState="RENDERED" title="Dutch Audio Cap" override="allowed" /> 8 <uGroup id="uk_aud" uState="NOT_RENDERED" title="English Audio Cap" override="allowed" /> 9 <uGroup id="nl_txt" uState="NOT_RENDERED" title="Dutch Text Cap" override="allowed" /> 10 <uGroup id="UK_txt" uState="NOT_RENDERED" title="English Text Cap" override="allowed" /> 11 </userAttributes> 12 </head> 13 <body> 14 ... 15 <par> 16 <video src="announcer.rm" region="a"/> 17 <text src="news_headline.html" region="b"/> 18 <audio src="story_1_nl.rm" uGroup="nl_aud"/> 19 <audio src="story_1_uk.rm" uGroup="UK_aud-cam"/> 20 <text src="story_1_nl.html" uGroup="nl_txt" region="c"/> 21 <text src="story_1_uk.html" uGroup="UK_txt" region="d"/> 22 </par> 23 ... 24 </body> 25 </smil>
Lines 6 through 11 define the available groups. Each group contains an identifier and a title (which can be used by the user-agent to label the group), as well as the (optional) initial state definition and override flag.
In line 7, a uGroup named "nl_aud" is defined for Dutch audio captions that is initially set to RENDERED. The other groups in this (very simple) example are set to NOT_RENDERED.
In lines 15 through 22, a SMIL <par> construct is used to identify a portion of a presentation. In this <par>, a single video (line 16) is accompanied by two audio streams (18,19) and two text streams (20,21), one each for English and Dutch. The <par> also contains a text title that contains a headline.
The interaction of the user interface and the initial state determine which objects are rendered. Note that the same attributes are used across the entire document, meaning that the user only needs to select his/her content preferences once to control related groups of information. In the example, user is free to have the video and headline text accompanied by any combination of English and Dutch captions. (Note that if two audio captions are selected, the player will need to determine how these are processed for delivery.)
While this example shows in-line use of user groups, the groups could also be applied as test attributes in a switch. Similarly, the system test attributes typically found in a switch could also be used in-line as a control attribute on an element along with the uGroup attribute.
This element will give a suggestion or hint to a user-agent that a media resource will be used in the future and the author would like part or all of the resource fetched ahead of time to make the document playback smoother. User-agents can ignore prefetch elements, though doing so may cause an interruption in the document playback when the resource is needed. It gives authoring tools or savvy authors the ability to schedule retrieval of resources when they think that there is available bandwidth or time to do it. A prefetch element is contained within the body of an XML document, and its scheduling is based on its lexical order unless explicit timing is present.
The prefetch element, like media object elements, can have id and src. If SMIL Boston Timing is integrated into the document, begin, end, dur, clipBegin, and clipEnd attributes are also available. The id and src elements are the same as for other media objects. id names the element for reference in the document and src names the resource to be prefetched. When a media object with the same src URL is encountered the user-agent can use any data it prefetched to begin playback without rebuffering or other interruption. The timing attributes begin, end, dur would constrain the presentation time period for prefetching the element. At the end of the presentation time specified by end or dur, the prefetch operation should stop. The clipBegin, and clipEnd elements are used to identify the part of the src clip to prefetch, if only the last 30s of the clip are being played, we don't want to prefetch it from the beginning. Likewise if only the middle 30 seconds of the clip are begin played, we don't want to prefetch more data than will be played.
If both mediaSize and mediaTime are specified, mediaSize is used and mediaTime is ignored.
For discrete media (non-time based media like text/html or image/png) using the mediaTime attribute causes the entire resource to be fetched.
Any attribute with a value of "0%" is ignored and treated as if the attribute wasn't specified.
Documents must still playback even when the prefetch elements are ignored, although rebuffering or pauses in presentation of the document may occur. If the prefetch for a prefetch element is ignored, any timing on the element is still respected, e.g. is a prefetch has a dur="5s", elements that depend on the prefetch element's timing behave as if the prefetch took 5 seconds.
If a prefetch element is repeated, due to restart or repeat on a parent element the prefetch operation should occur again. This insures appropriately "fresh" data is displayed if, for example, the prefetch is for a banner ad to a URL whose content changes with each request.
If the clipBegin or clipEnd in the media object are different from the prefetch, an implementation can use any data that was fetched but the result may not be optimal.
Note that prefetching data from a URL that changes the content dynamically is dangerous if the entire resource isn't prefetched as the subsequent request for the remaining data may yield data from a newer resource. A user-agent should respect any appropriate caching directives applied to the content, e.g. no-cache 822 headers in HTTP. More specifically, content marked as non-cacheable would have to be refetched each time it was played, where content that is cacheable could be prefetched once, with the results of the prefetch cached for future use.
Attribute value syntax
bytes-value ::= Digit+; any positive number
percent-value ::= Digit+ "%"; any positive number in the range
0 to 100
Clock-val ::= ( Hms-val | Smpte-val )
Smpte-val ::= ( Smpte-type )? Hours ":" Minutes ":" Seconds
( ":" Frames ( "." Subframes )? )?
Smpte-type ::= "smpte" | "smpte-30-drop" | "smpte-25"
Hms-val ::= ( "npt=" )? (Full-clock-val | Partial-clock-val
Full-clock-val ::= Hours ":" Minutes ":" Seconds ("." Fraction)?
Partial-clock-val ::= Minutes ":" Seconds ("." Fraction)?
Timecount-val ::= Timecount ("." Fraction)? (Metric)?
Metric ::= "h" | "min" | "s" | "ms"
Hours ::= DIGIT+; any positive number
Minutes ::= 2DIGIT; range from 00 to 59
Seconds ::= 2DIGIT; range from 00 to 59
Frames ::= 2DIGIT; @@ range?
Subframes ::= 2DIGIT; @@ range?
Fraction ::= DIGIT+
Timecount ::= DIGIT+
2DIGIT ::= DIGIT DIGIT
DIGIT ::= [0-9]
For Timecount values, the default metric suffix is "s" (for seconds).
bitrate-value ::= Digit+; any positive number
1 <smil> 2 <body> 3 <seq> 4 <par> 5 <prefetch id="endimage" 6 src="http://www.w3c.org/logo.gif"/> 7 <text id="interlude" 8 src="http://www.w3c.org/pleasewait.html" fill="freeze"/> 9 </par> 10 <video id="main-event" src="rtsp://www.w3c.org/video.mpg"/> 11 <image src="http://www.w3c.org/logo.gif" fill="freeze"/> 12 </seq> 13 </body> 14 </smil>
No timing is specified so default timing applies in the above example. The text is discrete media so it ends immediately, the prefetch is defaulted to prefetch the entire image at full available bandwidth and the prefetch element ends when the image is downloaded. That ends the <par> and the video begins playing. When the video ends the image is shown.
1 <html> 2 <body> 3 <prefetch id="upimage" src="http://www.w3c.org/up.gif"/> 4 <prefetch id="downimage" src="http://www.w3c.org/down.gif"/> 5 .... 6 <!-- script will change the graphic on rollover --> 7 <img src="http://www.w3c.org/up.gif"/> 8 </body> 9 </html>