previous next contents

# 6. The SMIL 2.0 Linking Modules

Editors
  Lloyd Rutledge (Lloyd.Rutledge@cwi.nl), (CWI)
  Aaron Cohen (aaron.m.cohen@intel.com), (Intel)

## Table of contents

## 6.1 Introduction

The SMIL 2.0 Linking Modules define the SMIL 2.0 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.0 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.0 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.0 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.

## 6.2 Relationship with Other XML Linking-related Formats

### 6.2.1 Relationship with XPointer

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.0 specification allows but does not require that user agents be able to process XPointers in SMIL 2.0 URI attribute values.

### 6.2.2 Relationship with XLink

Where possible, SMIL linking constructs have the same element, attribute and value 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 once XLink is released as a recommendation and 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.0 specification.

### 6.2.3 Relationship with XML Base

SMIL profiles may use XML Base [XMLBase]. The SMIL 2.0 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.

### 6.2.4 Relationship with XHTML

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 language's linking constructs as XLink once the format is released. The linking constructs in SMIL, however, fall under the namespaces defined in SMIL 2.0, and not under any XHTML-related namespace.

## 6.3 Linking into SMIL 2.0 Documents

The SMIL 2.0 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.0 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.0 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.0 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.0 Timing and Synchronization Modules.

### 6.3.1 Handling of Links in Embedded Documents

Due to its integrating nature, the presentation of a SMIL 2.0 document may involve other (non-SMIL) applications or plug-ins. For example, a SMIL 2.0 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.0 document embedded in an HTML page. Note that this is only one of the supported methods of integrating SMIL 2.0 and HTML. Another alternative is to use the merged language approach. See the SMIL 2.0 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.0 implementations may choose not to comply with this recommendation.

If a link is defined in an embedded SMIL 2.0 document, traversal of the link affects only the embedded SMIL 2.0 document.

If a link is defined in a non-SMIL document which is embedded in a SMIL 2.0 document, link traversal can only affect the presentation of the embedded document and not the presentation of the containing SMIL 2.0 document. This restriction may be relaxed in future versions of SMIL.

### 6.3.2 Error Handling

When a link into a SMIL 2.0 document contains an un-resolvable fragment identifier ("dangling link") because it identifies an element that is not actually part of the document, SMIL 2.0 software should ignore the fragment identifier, and start playback from the beginning of the document.

When a link into a SMIL 2.0 document contains a fragment identifier which identifies an element that is the content of a switch element, SMIL 2.0 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.

## 6.4 SMIL 2.0 LinkingAttributes Module

The SMIL 2.0 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.

sourceLevel
  This attribute sets the relative audio volume of media objects in the presentation containing the link when the link is followed. This attribute takes non-negative percentage values. The units of the sourceLevel attribute are consistent with those described for the soundLevel attribute of the SMIL 2.0 Layout Modules, and the audio levels are modified in the same manner. The application of sourceLevel volume control is cumulative with any media specific volume control (such as the soundLevel attribute) on the presentation containing the link. When the display of the destination resource completes, the effect of soundLevel attribute on the originating presentation should be removed. The default value is '100%'.
destinationLevel
  This attribute sets the relative audio volume of media objects in the remote resource when the link is followed. This attribute can take non-negative percentage values. The destinationLevel attribute is applied to the natural or intrinsic audio volume of the destination media, and therefore is relative to the volume that the media would be played without application of the destinationLevel attribute. The units of the destinationLevel attribute are consistent with those described for the soundLevel attribute of the SMIL 2.0 Layout Modules, and the audio levels are modified in the same manner. The application of destinationLevel volume control is cumulative with any media specific volume control (such as the soundLevel attribute) specified by the remote resource. The default value is '100%'.
sourcePlaystate
  This attribute controls the temporal behavior of the presentation containing the link when the link is traversed. It can have the following values:
  - play: When the link is traversed, the presentation containing the link continues playing.
  - pause: When the link is traversed, the presentation containing the link pauses. When the display of the destination resource completes, the originating presentation should resume playing.
  - stop: When the link is traversed, the presentation containing the link stops. That is, it is reset to the beginning of the presentation. The termination of the destination resource will not cause the originating presentation to continue or restart.
  The value of the show attribute can determine the default value of or override the assignment of the sourcePlaystate attribute. In general, the show attribute takes precendence over the sourcePlaystate attribute. The rules for the impact of show on sourcePlaystate are:
  - If the show attribute is assigned the value new, then the default for the sourcePlaystate attribute is play.
  - If the show attribute is assigned the value replace or the deprecated value pause, then the presentation behaves as if the sourcePlaystate attribute had been set to pause. Any assignment of the sourcePlaystate attribute is ignored.
  Note that the definition of what constitutes a resource completing needs to be defined in the language profile, or may be implementation dependent. Typical definitions would be when the user closes the display window, or when a continuous media object ends.
destinationPlaystate
  This attribute controls the temporal behavior of the external resource (typically identified by the href attribute) when the link is followed. It only applies when this resource is a continuous media object. It can have the following values:
  - play: When the link is traversed, the destination of the link plays.
  - pause: When the link is traversed, the destination of the link is displayed in a paused state at the point depicted by the value of the href attribute.

  The default value is play.

show
  This attribute specifies how to handle the current state of the presentation at the time in which the link is activated. The following values are allowed:
  - new: The presentation of the destination resource starts in a new context, not affecting the source resource. If both the presentation containing the link and the remote resource contain audio media, both are played in parallel.
  - pause: This value is deprecated in favor of setting the show attribute to new and the sourcePlaystate attribute to pause.
  - replace: The current presentation is paused at its current state and is replaced by the destination resource. If the player offers a history mechanism, the source presentation resumes from the state in which it was paused when the user returns to it. The default value of sourcePlaystate is pause when the show attribute has the value replace. If the link destination is within the same document in which this link element lies, then any assignment of this element's sourcePlaystate attribute is ignored, and the link is processed as if the value of sourcePlaystate was stop. For more discussion regarding hyperlinking within the current document, see the "Hyperlinks and Timing" section of the SMIL 2.0 Timing and Synchronization Modules.

  The default value of show is replace.

external
  This attribute defines whether the link destination should be opened by the current application or some external application. A value of true will open the link in an application defined on the system to handle this media type. A value of false will open the destination in the current application. The default value of external is false. Note that the means of associating media types with external applications is system dependent and not defined here.
actuate
  The actuate attribute determines whether or not the link is triggered by some event or automatically traversed when its time span is active. Its default value is onRequest, which means something must trigger the link traversal, typically user interaction. A value of onLoad can also be assigned. This value indicates that the link is automatically traversed when the linking element becomes active. For linking elements containing SMIL timing, this is when the active duration of the linking element effectively begins, in other words, when the element's beginEvent event is fired. This means that a SMIL link can be encoded to be triggered by any event that can trigger the begin of a timed element. See the SMIL 2.0 Timing and Synchronization Modules for more details.

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:

alt
  This attribute is defined for SMIL 2.0 in the SMIL 2.0 Media Object Modules. The recommendations given there for the alt attribute on media object elements apply to its use in linking elements as well.
accesskey
  This attribute assigns a keyboard key whose activation by the user in turn activates this link. It has the same meaning as the attribute of the same name in HTML [HTML4]. Keystroke-actived links in embedded presentations stay effective when embedded -- that is, if the user hits that key during the SMIL presentation, that navigation occurs within the embedded media. The rules for disambiguating links in multiple objects are:
  - Keystroke links defined in SMIL dominate over those defined in embedded media.
  - When simultaneously active SMIL linking elements have the same "accesskey", then priority goes to the one activated earliest, then to the one defined first on the SMIL code.
  - In profiles in which the SMIL 2.0 Layout Modules are used, link in media objects placed in the foremost region dominate, as defined by "stacking level" in the SMIL 2.0 Layout Modules.
  - Media objects for which no region is assigned are assumed to be more forward on the stacking level than all media objects assigned regions. This accounts for the possibility of audio objects that have keystroke input, such as hyperlinked talking books for the sight-impaired.
tabindex
  This attribute provides the same functionality as the tabindex attribute in HTML [HTML4]. It specifies the position of the element in the tabbing order for the current document. The tabbing order defines the order in which elements will receive focus when navigated by the user via the keyboard. At any particular point in time, only elements with an active timeline are taken into account for the tabbing order. Inactive elements that ignored for the tabbing order.
  When a media object element has a tabindex attribute, then its ordered tab index is inserted in the SMIL tab index at the location specified by the media object's tabindex attribute value. This assumes the media object itself has tab indices, such as embedded HTML with tabindex attributes. This enables all link starting points in a SMIL presentation to have a place on the ordered list to be tab-keyed through, including those in embedded presentations.
target
  This attribute defines either the existing display environment in which the link should be opened (e.g., a SMIL region, an HTML frame or another named window), or triggers the creation of a new display environment with the given name. Its value is the identifier of the display environment. If no currently active display environment has this identifier, a new display environment is opened and assigned the identifier of the target. When a presentation uses different types of display environments (e.g. SMIL regions and HTML frames), the namespace for identifiers is shared between these different types of display environments. For example, one cannot use a target attribute with the value "foo" twice in a document, and have it point once to an HTML frame, and then to a SMIL region. If the element has both a show attribute and a target attribute, the show attribute is ignored.

Examples

These examples are encoded in the SMIL 2.0 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/2001/SMIL20/WD/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 link 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/2001/SMIL20/WD/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>

## 6.5 SMIL 2.0 BasicLinking Module

The link elements allows the description of navigational links between objects. SMIL 2.0 linking provides only uni-directional, single-headed, in-line link elements.

### 6.5.1 The a Element

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.0 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.

Attributes

href
  This attribute has the same syntax and semantics as the href attribute of HTML [HTML4]. It contains the URI of the link's destination. The href attribute is required for a elements.

The a element also includes the attributes defined in the SMIL 2.0 LinkingAttributes Module:

- sourceLevel
- destinationLevel
- sourcePlaystate
- destinationPlaystate
- alt
- show
- accesskey
- tabindex
- target
- external
- actuate

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.

Examples

These examples are encoded in the SMIL 2.0 Language Profile.

Example 1

The link starts up the new presentation replacing the presentation that was playing.

    <smil xmlns="http://www.w3.org/2001/SMIL20/WD/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/2001/SMIL20/WD/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.0 player to spawn off an HTML user agent:

    <smil xmlns="http://www.w3.org/2001/SMIL20/WD/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/2001/SMIL20/WD/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/2001/SMIL20/WD/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/2001/SMIL20/WD/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>

### 6.5.2 The area Element

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.0 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 the 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.0 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 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.0, the anchor element should be treated as a synonym for area

Attributes

The area element can have the attributes listed below, with the same syntax as in HTML [HTML4] and, where applicable, the same semantics:

href
  Defined in the BasicLinking module.
alt
  Defined in the LinkingAttributes module.
tabindex
  Defined in the LinkingAttributes module.
accesskey
  Defined in the LinkingAttributes module.
target
  Defined in the LinkingAttributes module.
nohref
  When set, this boolean attribute specifies that the region has no associated link, even if other area elements for the media object define links for it.
shape
  This attribute specifies the shape of an anchor on the screen.
coords
  This attribute specifies the position and shape of the anchor on the screen. The number and order of values depends on the shape being defined. Where SMIL and HTML share visual display behavior, the coords attribute of SMIL has the same behavior as in HTML [HTML4]. How the coords attribute of SMIL applies to SMIL visual display behavior is as follows:
  1. The upper-left corner origin used by the coords attribute is in the image display space, not the region it is displayed in. One example of when the image and region upper-left corner differ is when left and top attributes are used in the media object elements and applied to the region.
  2. As in HTML, pixel values of the coords attribute refer to the pixels of the display space - that is, typically, of the user's screen. These can differ from the pixel values of the source image. One example of when they can differ in SMIL is when the fit attribute of the region element used is not "hidden".
  3. In SMIL, it is possible for a portion of the image to be not visible. For example, this can happen when the fit attribute of the region element is hidden, and the image is bigger in pixels than the region. In such cases, the rules for placing active areas on the image apply to the screen space the image would take if no cropping occurred. This is particular important to note for percentage values: these do not apply to the cropped image but to the space the image would occupy if it weren't cropped. Areas that, with this rule, are placed beyond display boundaries are not active.
  If multiple area element children of the same media object element define simultaneously active overlapping areas with their coords attributes, then, as in HTML [HTML4], the area element that is encoded earliest in the document takes precedence.

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:

- sourcePlaystate
- destinationPlaystate
- show
- sourceLevel
- destinationLevel
- external
- actuate

Element Content

The area element is empty.

Examples

These examples are encoded in the SMIL 2.0 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/2001/SMIL20/WD/Language">
      <body>
        <video src="video" title="Interview" >
            <area id="firstQ" begin="0s" dur="20s" title="first question" />
            <area id="firstA" begin="prev.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/2001/SMIL20/WD/Language">
      <body>
        <video src="video" title="Interview" >
          <area shape="rect" coords="5,5,50,50"
                  title="Journalist" href="http://www.example.org/>
          <area shape="rect" coords="60,5,100,50"
                  title="Subject" href="http://www.example.org/>
       </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/2001/SMIL20/WD/Language">
      <body>
        <video src="video" title="Interview" >
            <area begin="0s" dur="20s" title="first question"
                  href="http://www.example.org/>
            <area begin="20s" dur="50s" title="first answer"
                  href="http://www.example.org/>
       </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/2001/SMIL20/WD/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/2001/SMIL20/WD/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/2001/SMIL20/WD/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/2001/SMIL20/WD/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/2001/SMIL20/WD/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/2001/SMIL20/WD/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/2001/SMIL20/WD/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>

## 6.6 SMIL 2.0 ObjectLinking Module

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.

### 6.6.1 The fragment Attribute

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.

fragment
  This attribute refers to a portion of the embedded media object that is to act as the starting point of this link in the SMIL presentation. If this user clicks on, or otherwise activates, this portion of the embedded media display, the SMIL user agent recognizes this as the current link being activated. This overrides any linking that may happen within the embedded display of the media object.

  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/2001/SMIL20/WD/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.0 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.0 file is:

       <smil xmlns="http://www.w3.org/2001/SMIL20/WD/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>

previous next contents