This section is informative.
The SMIL 2.1 specification leaves the SMIL 2.0 Linking Modules [SMIL20-linking] unchanged.
This section is informative.
The SMIL 2.1 Linking Modules define the SMIL 2.1 document attributes and elements for navigational hyperlinking. These are navigations through the SMIL presentation that can be triggered by user interaction or other triggering events, such as temporal events. SMIL 2.1 provides only for in-line link elements. Links are limited to uni-directional single-headed links (i.e. all links have exactly one source and one destination resource).
The SMIL 2.1 Linking Modules are named LinkingAttributes, BasicLinking and ObjectLinking. The LinkingAttributes module includes a set of attributes used to provide SMIL linking semantics to linking elements. The BasicLinking module includes the SMIL 2.1 linking elements themselves. The ObjectLinking module includes additional optional linking features that a language profile may wish to include. Note that the BasicLinking module explicitly includes the attributes from the LinkingAttributes module on its elements.
XPointer [XPTR] allows components of XML documents to be addressed in terms of their placement in the XML structure rather than on their unique identifiers. This allows referencing of any portion of an XML document without having to modify that document. Without XPointer, pointing within a document may require adding unique identifiers to it, or inserting specific elements into the document, such as a named anchor in HTML. XPointers are put within the fragment identifier part of a URI [URI] attribute value. The SMIL 2.1 specification allows but does not require that user agents be able to process XPointers in SMIL 2.1 URI attribute values.
Where possible, SMIL linking constructs have the same names as constructs from XLink [XLINK]. This makes it easier to learn to write linking in code in both formats: authors familiar with XLink can more quickly learn SMIL linking, and vice versa. It also makes it easier for SMIL code to be processed into and recognized as XLink code when the appropriate transform mechanisms become available. However, the SMIL linking attributes are distinct from the XLink constructs and are part of a separate namespace. Using SMIL's modularization mechanism, these constructs are not in the XLink namespace but in the namespaces defined in the SMIL 2.1 specification.
SMIL profiles may use XML Base [XMLBase]. The SMIL 2.1 Language Profile, for example, includes support for XML Base. When XML Base is incorporated into a profile, XML Base declarations apply to the URI attribute values of SMIL used in that profile's documents. These attributes include the href attribute of the SMIL BasicLinking Module and the src attribute of the SMIL BasicMedia Module.
The elements names, attributes names and attribute values of SMIL linking constructs are, where possible, the same as constructs in XHTML [XHTML11] with corresponding linking behavior. This facilitates learning and writing in both languages and avoids confusion. It may also facilitate the processibility of both languages' linking constructs as XLink once the format is released. The linking constructs in SMIL, however, fall under the namespaces defined in SMIL 2.1, and not under any XHTML-related namespace.
The SMIL 2.1 Linking Modules support name fragment identifiers and the '#' connector. The fragment part is an id value that identifies one of the elements within the referenced SMIL document. With this construct, SMIL 2.1 supports locators as currently used in HTML (that is, it uses locators of the form "http://www.example.org/some/path#anchor1"), with the difference that the values are of unique identifiers and not the values of "name" attributes. Of course, this type of link can only target elements that have an attribute of type ID.
Links using fragment identifiers enable authors to encode links to a SMIL 2.1 presentation at the start time of a particular element rather than at the beginning of its presentation. If a link containing a fragment part is followed, the presentation should start as if the user had fast-forwarded the presentation represented by the destination document to the effective begin of the element designated by the fragment. See the discussion of linking to timing constructs in the SMIL 2.1 Timing and Synchronization Modules for more information.
There are special semantics defined for following a link containing a fragment part into a document containing SMIL timing. These semantics are defined in the SMIL 2.1 Timing and Synchronization Modules.
Due to its integrating nature, the presentation of a SMIL 2.1 document may involve other (non-SMIL) applications or plug-ins. For example, a SMIL 2.1 user agent may use an HTML plug-in to display an embedded HTML page. Vice versa, an HTML user agent may use a SMIL plug-in to display a SMIL 2.1 document embedded in an HTML page. Note that this is only one of the supported methods of integrating SMIL 2.1 and HTML. Another alternative is to use the merged language approach. See the SMIL 2.1 Modules for further details.
In embedded presentations, links may be defined by documents at different levels and conflicts may arise. In this case, the link defined by the containing document should take precedence over the link defined by the embedded object. Note that since this might require communication between the user agent and the plug-in, SMIL 2.1 implementations may choose not to comply with this recommendation.
If a link is defined in an embedded SMIL 2.1 document, traversal of the link affects only the embedded SMIL 2.1 document.
If a link is defined in a non-SMIL document which is embedded in a SMIL 2.1 document, link traversal can only affect the presentation of the embedded document and not the presentation of the containing SMIL 2.1 document. This restriction may be relaxed in future versions of SMIL.
When a link into a SMIL 2.1 document contains an un-resolvable fragment identifier ("dangling link") because it identifies an element that is not actually part of the document, SMIL 2.1 software should ignore the fragment identifier, and start playback from the beginning of the document.
When a link into a SMIL 2.1 document contains a fragment identifier which identifies an element that is the content of a switch element, SMIL 2.1 software should interpret this link as going to the outermost ancestor switch element instead. In other words, the link should be considered as accessing the switch ancestor element that is not itself contained within a switch.
The SMIL 2.1 LinkingAttribues module defines several attributes that a language profile can include on linking elements to add SMIL linking semantics to those elements. The elements in the BasicLinking Module explicitly include these attributes. These attributes can be applied to linking elements from other namespaces if allowed by the language profile.
The default value is play.
The default value of show is replace.
Each of the following attributes has the same syntax as the attributes of the same name in HTML [HTML4] and, where applicable, the same semantics:
Examples
These examples are encoded in the SMIL 2.1 Language Profile.
Example 1
This examples shows the use of the target and accesskey attributes. The upper half of the display shows an image. If the user clicks on the image, a SMIL presentation is played in the lower half of the display. The same thing happens if the user hits the 'a' key.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> <head> <layout> <region id="source" height="50%"/> <region id="destination" top ="50%"/> </layout> </head> <body> <a href="embeddedSMIL.smil" target="destination" accesskey="a"> <img region="source" src="source.jpg" dur="indefinite"/> </a> </body> </smil>
Example 2
This example shows the use of the tabindex attribute on media object elements. The HTML file "caption1.html" has 3 links, so the first 3 tabs focus on those links in turn. The file caption2.html has 4 links, so tabs 4-7 focus on them in turn. Tabs 8 and 9 focus the two links inside v1.mpg. Tab 10 focuses on the whole presentation of graph.imf. If any of the first 9 tabbed foci is activated, then a link inside one of the embedded presentations caption1.html, caption2.rtx or v1.mpg is triggered, affecting only that presentation. If the 10th tabbed focus is activated, then the SMIL presentation itself is affected, loading http://www.example.org/presentation into the same presentation space.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <seq> <video src="http://www.example.org/graph.imf"/> <par> <a tabindex="4" href="http://www.example.org/presentation"> <video src="http://www.example.org/graph.imf" ... /> </a> <video tabindex="3" src="http://www.example.org/v1.mpg" ... /> <text tabindex="1" src="http://www.example.org/caption1.html" ... /> <text tabindex="2" src="http://www.example.org/caption2.html" ... /> </par> </seq>
The link elements allows the description of navigational links between objects. SMIL 2.1 linking provides only uni-directional, single-headed, in-line link elements.
The functionality of the a element is very similar to the functionality of the a element in HTML [HTML4]. For synchronization purposes, the a element is transparent. That is, it does not influence the synchronization of its child elements. a elements may not be nested. An a element must have an href attribute.
An a element can specify several triggers for its traversal simultaneously. For example, the element's content visual media can be selected by the user or the key specified by the accesskey attribute can be typed to trigger a traversal. In cases where multiple triggers are specified, any of them can activate the link's traversal. That is, a logical OR is applied to the list of triggering conditions to determine if traversal occurs.
Traversal occurs if one of the conditions for traversal is met during the time that the a element is active. An a element is sensitive if the media or elements that it contains are active or frozen. See the SMIL 2.1 Timing and Synchronization Modules for further details. For timing purposes an a element is considered to be discrete media, that is, the intrinsic duration is 0. Note that an a element is not a time container and does not constrain the timing of its child elements.
The a element also includes the attributes defined in the SMIL 2.1 LinkingAttributes Module:
Element Content
The content of the a element must be defined by the language profile. In general, it is expected that a elements may contain the media and timing elements present in the language profile as children.
Other Integration Requirements
Language profiles that apply SMIL 2.1 timing to the a element must specify the default and allowed values of the fill attribute on the a element. Languages applying SMIL 2.1 timing to the a element wishing to remain compatible with SMIL 1.0, such as the SMIL 2.1 language profile, must default the value of the fill attribute on the a element to auto, and should consider fixing the value to auto. In all other cases, for compatibility, it is recommended to use a default value of auto.
If not otherwise specified by the profile, the value of the fill attribute on the a element is fixed to auto.
Examples
These examples are encoded in the SMIL 2.1 Language Profile.
Example 1
The link starts up the new presentation replacing the presentation that was playing.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <a href="http://www.example.org/somewhereelse.smi"> <video src="rtsp://www.example.org/graph.imf" region="l_window"/> </a>
Example 2
The link starts up the new presentation in addition to the presentation that was playing.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <a href="http://www.example.org/somewhereelse.smi" show="new"> <video src="rtsp://www.example.org/graph.imf" region="l_window"/> </a>
This could allow a SMIL 2.1 player to spawn off an HTML user agent:
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <a href="http://www.example.org/somewebpage.html" show="new"> <video src="rtsp://www.example.org/graph.imf" region="l_window"/> </a>
Example 3
The link starts up the new presentation and pauses the presentation that was playing.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <a href="http://www.example.org/somewhereelse.smi" show="new" sourcePlaystate="pause"> <video src="rtsp://www.example.org/graph.imf" region="l_window"/> </a>
Example 4
The following example contains a link from an element in one presentation A to the middle of another presentation B. This would play presentation B starting from the effective begin of the element with id "next".
Presentation A: <smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <a href="http://www.example.org/presentationB#next"> <video src="rtsp://www.example.org/graph.imf"/> </a> Presentation B (http://www.example.org/presentation): <smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <seq> <video src="rtsp://www.example.org/graph.imf"/> <par> <video src="rtsp://www.example.org/timbl.rm" region="l_window"/> <video id="next" src="rtsp://www.example.org/v1.rm" region="r_window"/> ^^^^^^^^^ <text src="rtsp://www.example.org/caption1.html" region="l_2_title"/> <text src="rtsp://www.example.org/caption2.rtx" region="r_2_title"/> </par> </seq>
The functionality of the a element is restricted in that it only allows associating a link with a complete media object. The HTML area element [HTML4] has demonstrated that it is useful to associate links with spatial portions of an object's visual display.
The semantics of the area element in SMIL 2.1 is the same as it is for HTML in that it can specify that a spatial portion of a visual object can be selected to trigger the appearance of the link's destination. The coords attribute specifies this spatial portion. In contrast, if an a element is applied to a visual object, then it specifies that any visual portion of that object can be selected to trigger the link traversal.
The area element also extends the syntax and semantics of the HTML area element by providing for linking from non-spatial portions of the media object's display. When used in profiles that include SMIL 2.1 Timing and Synchronization Modules, the area element allows breaking up an object into temporal subparts, using attributes such as the begin and end attributes. The values of the begin and end attributes are relative to the beginning of the containing media object. The area element can allow to make a subpart of the media object the destination of a link, using these timing attributes and the id attribute.
The anchor element of SMIL 1.0 [SMIL10] is deprecated in favor of area. For purposes of this specification of SMIL 2.1, the anchor element should be treated as a synonym for area
The area element can have the attributes listed below, with the same syntax as in HTML [HTML4] and, where applicable, the same semantics:
The following attributes of the area element are unique to SMIL and not found in HTML. They are defined above in the section on LinkingAttributes module attributes:
Element Content
The area element is empty.
Examples
These examples are encoded in the SMIL 2.1 Language Profile.
1) Decomposing a video into temporal segments
In the following example, the temporal structure of an interview in a newscast (camera shot on interviewer asking a question followed by shot on interviewed person answering) is exposed by fragmentation:
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> <body> <video src="video" title="Interview" > <area id="firstQ" begin="0s" dur="20s" title="first question" /> <area id="firstA" begin="first0.end" dur="50s" title="first answer" /> </video> </body> </smil>
2) Associating links with spatial segments In the following example, the screen space taken up by a video clip is split into two sections. A different link is associated with each of these sections.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> <body> <video src="video" title="Interview" > <area shape="rect" coords="5,5,50,50" title="Journalist" href="http://www.example.org/journalist"/> <area shape="rect" coords="60,5,100,50" title="Subject" href="http://www.example.org/subject"/> </video> </body> </smil>
3) Associating links with temporal segments
In the following example, the duration of a video clip is split into two sub-intervals. A different link is associated with each of these sub-intervals.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> <body> <video src="video" title="Interview" > <area begin="0s" dur="20s" title="first question" href="http://www.example.org/question"/> <area begin="20s" dur="50s" title="first answer" href="http://www.example.org/answer"/> </video> </body> </smil>
4) Associating links with spatial subparts
In the following example, two areas are assigned in the screen space taken up by a video clip. A different link is associated with each of these areas.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <video src="http://www.example.org/CoolStuff"> <area href="http://www.example.org/AudioVideo" coords="0%,0%,50%,50%"/> <area href="http://www.example.org/Style" coords="50%,50%,100%,100%"/> </video>
5) Associating links with temporal subparts
In the following example, the duration of a video clip is split into two subintervals. A different link is associated with each of these subintervals.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <video src="http://www.example.org/CoolStuff"> <area href="http://www.example.org/AudioVideo" begin="0s" end="5s"/> <area href="http://www.example.org/Style" begin="5s" end="10s"/> </video>
6) Jumping to a subpart of an object
The following example contains a link from an element in one presentation A to the middle of a video object contained in another presentation B. This would play presentation B starting from second 5 in the video. That is, the presentation would start as if the user had fast-forwarded the whole presentation to the point at which the designated fragment in the "CoolStuff" video begins.
Presentation A: <smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <a href="http://www.example.org/mm/presentationB#tim"> <video id="graph" src="rtsp://www.example.org/graph.imf" region="l_window"/> </a> Presentation B: <smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <video src="http://www.example.org/CoolStuff"> <area id="joe" begin="0s" end="5s"/> <area id="tim" begin="5s" end="10s"/> </video>
7) Combining different uses of links
The following example shows how the different uses of associated links can be used in combination.
Presentation A: <smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <a href="http://www.example.org/mm/presentationB#tim"> <video id="graph" src="rtsp://www.example.org/graph.imf" region="l_window"/> </a> Presentation B: <smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <video src="http://www.example.org/CoolStuff"> <area id="joe" begin="0s" end="5s" coords="0%,0%,50%,50%" href="http://www.example.org/"/> <area id="tim" begin="5s" end="10s" coords="0%,0%,50%,50%" href="http://www.example.org/Tim"/> </video>
8) The coords attribute and re-sized images
The following example shows the image file "example.jpg", which has the dimensions of 100x100 pixels. The active area for "example1.smil" is the entire display space, which is the cropped upper-left quarter of the original image. The active area for "example2.smil" cannot be triggered because the image area corresponding to it was cropped.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> <head> <layout> <region id="region" right="50" bottom="50"/> </layout> </head> <body> <img src="example.jpg" region="region"> <area shape="rect" coords="0%,0%,50%,50%" href="example1.smil"/> <area shape="rect" coords="50%,50%,100%,100%" href="example2.smil"/> </img> </body </smil>
The contents of this section represent capabilities that can be optionally included in the document profile. These features may or may not be included in a language profile, but they should not be optional features within a profile. This module requires support of the BasicLinking Module.
A profile may choose to include the fragment attribute as part of the area element. It provides for a host document to externally include a link in a contained media object that will be processed at the level of the host document.
The value of the fragment attribute must be recognizable by the process managing the media object as an activate-able portion of the object. If the referenced media object is an HTML file, then the value of the fragment attribute is a named anchor within the HTML file. If the referenced media object is an XML file, then the value of the fragment attribute is a fragment identifier (the part that comes after a '#' in a URI [URI]).
Take for example the following SMIL code. It establishes a portion of the display as a formatted text menu. Clicking on an item in this menu triggers a link to elsewhere within the presentation.
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> ... <ref src="menu.html" region="menubar"> <area fragment="menuitem1" href="#selection1"/> </ref>
In the rendered HTML display, there is a portion of displayed text that is marked-up as an area with the name "menuitem1". If the user clicks on this during the SMIL presentation, a SMIL-activated link is triggered, navigating to the portion of the SMIL document with the ID "selection1". If the HTML area named "menuitem1" has an href attribute itself, then this hyperlink is overridden - only the SMIL hyperlink is processed. HTML area with href attributes and no associated SMIL fragment attributes are not overridden. This HTML area activates links within the embedded HTML presentation when clicked upon.
Use of the fragment attribute can override linking in the embedded media. If the attribute refers to a portion of the embedded media that is a link within that media, activating that link will trigger navigation in the SMIL presentation only, and not in the embedded presentation. For example, suppose a fragment attribute refers to a named anchor in an embedded HTML document. This named area has an href attribute, making it the starting point of a potential navigation within the HTML presentation itself. When embedded in the SMIL presentation, activation of this part of the HTML display triggers the SMIL link and not the HTML link. Links in embedded media that are not overridden in this manner, on the other hand, continue to trigger navigation within the embedded display when activated. All functionality defined for the SMIL link will override any equivalent functionality defined for the link in the embedded media. With the above example, the alt attribute of the SMIL area element would override the alt tag of the embedded HTML anchor.
The referencing performed by the fragment attribute only applies to one level of depth of embedded media. It only applies to directly embedded media; it does not apply to media embedded in turn within media embedded in a SMIL presentation. For example, consider a SMIL presentation that embeds a second SMIL presentation within it. The media object element of the first that embeds the second has within it an area element with a fragment attribute. The value of this attribute applies only to the embedded SMIL document itself. It does not apply to any media embedded within this second SMIL presentation.
Examples
These examples are encoded in the SMIL 2.1 Language Profile.
Associating links with syntactic subparts
Below is an example with an integrated HTML file that displays a menu of
link one link two
The user can click on one of the menu items, and the matching HTML file is displayed. That is, if user clicks on "link one", the "Link1.html" file is displayed in the "LinkText" region. Note that the links defined inside the embedded HTML presentation, those to "overridden1.html" and "overridden2.html" are not active when embedded here because they are overridden by the fragments.
The "menu.html" file contains the code:
<html> ... <A NAME="link1" HREF="overridden1.html">link one</A><BR/> <A NAME="link2" HREF="overridden2.html">link two</A>
The SMIL 2.1 file is:
<smil xmlns="http://www.w3.org/2005/SMIL21/Language"> <head> <layout> <region id="HTML" width="100" height="100"/> <region id="LinkText" width="100" top ="100"/> </layout> </head> <body> <par> <text region="HTML" src="menu.html" dur="indefinite"> <area fragment="link1" href="#LinkOne"/> <area fragment="link2" href="#LinkTwo"/> </text> <excl dur="indefinite" > <text id="LinkOne" region="LinkText" src="Link1.html" dur="indefinite"/> <text id="LinkTwo" region="LinkText" src="Link2.html" dur="indefinite"/> </excl> </par> </body> </smil>