The layout is probably the most important part of the structure of an SMIL document - it defines both global window attributes, such as window size and colour, for the presentation, as well as separate, independent regions for the various media clips that are to be integrated into the presentation. As I noted on the previous page, this layout information appears within the <head> of the SMIL document.
As you can see, the <layout> block above contains both
<root-layout> and <region> elements, the former defines window attributes, while the latter define separate regions within the presentation. The example above defines a window of height 400 pixels and width 500 pixels, and further defines a region within it named "alpha". This region will contain embedded content (discussed a little further down).
It should be noted that, apart from the absolute positioning demonstrated in the snippet above, SMIL also allows regions to be positions relative to the window. The following snippet defines a region that's always 20% away from the left window border and 40% away from the top window border.
Once the various <region>s have been defined, the next
step is to identify media elements to be embedded within each of them. The various media elements are defined within the <body> of the SMIL document and linked to a region using the region's "name" attribute. Consider the following example, which places the JPEG image "logo.jpg" in the region named “alpha”:
Each of the various media types supported by SMIL has a
corresponding element in the SMIL namespace, and can be referenced using that element. Here's a list:
Media type Element
Text streams <textstream>
Flash animation <animation>
Color block <brush>
Any other media type <ref>
Each of these elements has a list of attributes, which are
usually specific to that media type. Consider the following example, which uses a number of different media types in the same SMIL document:
And here's a brief list of what each of those attributes
id - defines a unique identifier for the media;
src - defines the source of the media file;
title - defines a title for the media clip;
alt - defines alternate text for the media clip
begin - defines the time at which the clip must start
end - defines the time at which the clip must stop
region - links the media to a defined region
This is not an exhaustive list - SMIL 2.0 contains a much larger list of attributes, some of them offering very fine-grained control over the media to be displayed. I'm not going to get into the details here - take a look at the SMIL 2.0 specification, linked at the end of this document, for details.