Chapter 6 explains the basics of SMIL, and shows how to open HTML pages when a single clip plays. This chapter builds on that foundation to show you how to play a sequence of clips using SMIL. It also introduces you to some of the SMIL timing attributes that you can use for clips and hyperlinks.
As "Writing a Ram File" explained, you can play a sequence of clips by listing the clips in order in a Ram file. If you want to use SMIL timing or linking with the clips, though, it's easier to define the sequence within a SMIL file. So instead of writing a separate SMIL file for each clip, you write one SMIL file that defines all of the features of the sequence. Your Ram file then links to the single SMIL file.
A sequence is the simplest type of SMIL group to create. Just list the clips
within <seq> and </seq> tags in the order that you want them to play. The
following example shows the entire SMIL markup required to play three audio
clips in sequence:
<smil xmlns="http://www.w3.org/2001/SMIL20/Language" |
In the preceding example, the second clip begins when the first clip finishes, and the third clip begins when the second clip finishes. A sequence can include any number of clips, and the clips can be of any type. You could add a video clip to the sequence shown above, for example. When using visual clips, though, you need to define a layout. Chapter 8 tackles layouts in general, but the section "Laying Out a Sequence of Videos" offers a "universal layout" for any sequence of videos.
When you enclose clips in <seq> and </seq> tags, RealPlayer treats the
sequence as a single presentation. If each clip in the preceding example is two
minutes in length, for example, the RealPlayer status bar indicates that the
presentation is six minutes long. Because RealPlayer treats the sequence as a
single presentation, viewers can use the timeline slider to seek through all the
clips, but cannot choose individual clips through the RealPlayer Play>Next
Clip command.
| View it now!
(requirements for viewing this sample)
Play this sample to hear a sequence of three audio clips that uses a <seq> group. Each clip
lasts 15 seconds. Note that RealPlayer indicates that the
presentation lasts 45 seconds, and that you cannot use the
Play>Next Clip command.
|
It is not necessary to use <seq> and </seq> tags to create a clip sequence.
Whenever clips are not listed in a group, RealPlayer plays them in sequence.
For instance, the following markup, which has no <seq> and </seq> tags, plays
three audio clips in sequence just like the preceding example:
<smil xmlns="http://www.w3.org/2001/SMIL20/Language" |
When you do not use a <seq> group, however, RealPlayer treats each clip as a
separate presentation. Suppose that each clip in the preceding example lasts
two minutes. When the sequence starts, the RealPlayer status bar indicates
that the presentation lasts two minutes. When the first clip ends, RealPlayer's
timeline slider resets, the second clip starts, and the status bar indicates
another two-minute presentation. This action repeats when the third clip
plays. At any point, the viewer can select a different clip with the RealPlayer
Play>Next Clip command.
| View it now!
(requirements for viewing this sample)
Play this sample to hear a sequence of three audio clips that does not use a <seq> group.
Each clip lasts 15 seconds, and the timeline slider resets after
each clip plays. You can also use the Play>Next Clip command.
|
When you play a sequence of visual clips such as videos, you need to define a layout. Otherwise, RealPlayer displays the clips in a checkerboard pattern, which is rarely desirable. However, it's easy to create a simple layout that sets a size for the media playback pane, then centers each video in the pane. Chapter 8 explains layouts in detail, but the following sample defines a universal layout that works for most video sequences:
<smil xmlns="http://www.w3.org/2001/SMIL20/Language" |
The preceding sample sets the size of the media playback pane to 320 pixels
wide by 240 pixels high. It then creates one playback region that expands to
that same size. Note that each clip includes region="video_region" to assign it
to the playback region, which uses id="video_region". The regPoint="center" and
regAlign="center" attributes place each clip in the center of the region. This
layout thereby accommodates any clip up to 320-by-240 pixels, which is as
large of a video that you can stream at high quality over low to moderate
connection speeds.
| View it now!
(requirements for viewing this sample)
Play this sample to see three video clips play in sequence. |
| For More Information: For more on bit rates and video sizes, see "Video Dimensions". |
The SMIL attributes listed in the following table let you override information encoded in a clip. They work like the Ram file parameters described in "Overriding Title, Author, and Copyright Information". When using these attributes in the SMIL file, however, do not also use the equivalent Ram file parameters.
Each attribute takes a text string for its value:
|
When you leave the <seq> tag out, as described in "Creating Sequences
Without the <seq> Tag", the individual clip titles display in the RealPlayer
"Now Playing" list:
<body> |
When you group clips within a <seq> or <par> tag, the clip titles are ignored.
You should therefore add title, author, and copyright information to the
group tag, as shown in the following example:
<seq |
For More Information:
For information about the <par> tag, see
"Playing Clips in Parallel". The SMIL file can also define
overall presentation information in addition to clip or group
information, as described in "Presentation Information".
|
SMIL includes many timing attributes that you can use in clips or hyperlinks. The following sections describe the most commonly used attributes. The following table lists the values that you can use in SMIL timing attributes.
Note:
Decimal values are not required. You can express two
seconds as "2s" or "2.0s", for example.
|
| Tip: RealPlayer displays a presentation's elapsed time in one- second increments. You can click the time-elapsed field to display time values to 1/10th of a second, however. This can help you decide what timing values to use with a clip. |
For More Information:
The endsync attribute, which affects
timing in a parallel group, is described in the section "Ending
a Parallel Group on a Specific Clip".
|
The section "Opening Several Web Pages During a Presentation" introduced
you to the begin attribute, which creates a timing delay. Using the begin
attribute, you can vary the point at which a hyperlink becomes active, or a clip
starts to play back within the presentation timeline:
<video src="rtsp://helixserver.example.com/video1.rm" |
In the preceding markup, the begin attribute delays the clip playback for 20.5
seconds. Were this clip in a sequence, there would be 20.5 seconds of blank
time before the clip starts.
Tip:
You can also use begin in <seq> and <par> tags to delay
playback of the entire sequence or parallel group. Parallel
groups are described in "Playing Clips in Parallel".
|
| View it now!
(requirements for viewing this sample)
This demonstration explains basic begin values.
|
The clipBegin and clipEnd attributes specify a clip's internal timing marks
where playback begins and ends. They allow you to play just part of a clip that
has an internal timeline, such as an audio, video, or animation clip. They have
no effect on groups or static clips such as still images, though. The following
example uses clipBegin and clipEnd with a video clip:
<video src="video1.rm" |
Here, the clip starts playing at its internal 10-second mark rather than at its encoded beginning. It stops when it reaches its 50-second mark, having played for a total of 40 seconds.
Tip:
The clipBegin and clipEnd attributes affect a clip in a SMIL
presentation the way that start and end affect a clip listed in a
Ram file. For more on start and end, see "Controlling How a
Presentation Initially Displays".
|
Warning!
Do not use clipBegin and clipEnd with live broadcasts,
or when delivering clips with a Web server. These attributes
function only for prerecorded clips streamed by Helix Server.
|
| View it now!
(requirements for viewing this sample)
This demonstration explains basic clipBegin and
clipEnd values.
|
The dur attribute controls how long a clip or group plays. The following
example ends the video after 85 seconds, regardless of the length of the clip's
internal timeline. If the video's timeline is shorter than 85 seconds, the video's
last frame appears frozen onscreen until the duration elapses:
<video src="video1.rm" |
A common use of dur is to control how long a static clip such as an image
appears onscreen. The following example displays an image for two minutes:
<img src="button1.gif" |
For More Information:
See also the fill attribute, which is
described in "Setting Clip Fills".
|
| View it now!
(requirements for viewing this sample)
This demonstration shows the use of a basic dur value.
|
The clip and timing attributes explained in this chapter are a small sample of the extensive SMIL 2.0 features described in RealNetworks Production Guide. You can download that guide from http://service.real.com/help/library/encoders.html to learn how to do the following:
.txt), or inline text, which you write directly in the SMIL file. RealText lets you set timing values on text blocks to coordinate them with other clips. A plain text file is handy for simple text needs, and inline text lets you easily annotate your SMIL file to provide onscreen clip titles, for instance.end attribute in addition to, or in place of, the dur attribute. The end attribute gives you added flexibility for defining clip durations, and is useful with interactive presentations.repeatCount or repeatDur attribute.min and max attributes. These additional timing capabilities can be useful in any cases.|
|
©2002, 2004 RealNetworks, Inc. All rights reserved.
For more information, visit RealNetworks Click here if the Table of Contents frame is not visible at the left side of your screen. |