This appendix will help you get the most out of a broad range of features available in RealSystem and SMIL. Before putting into practice the production tips given here, you should have a solid understanding of SMIL, as described in Chapter 6.
RealPlayer 7 and later have a View>Clip Source command that shows the SMIL markup of the current presentation. The RealServer or Web server hosting the presentation sends the markup as an HTML page that opens in your default Web browser. This feature lets you examine SMIL presentations to learn how they are created.
Access to SMIL source information is denied for secure presentations that require a user name and password. The RealServer administrator may also disallow access to the SMIL source file, or allow access to the source file but conceal the full paths of clips. When access is allowed, the Web page showing the SMIL syntax includes a hypertext link for each clip in the presentation. Clicking a link takes you to a new Web page with information about the corresponding clip, including its size, buffer time, and streaming bit rate.
By grouping clips played in sequence within a SMIL <par>
tag, you can create smooth transitions between the clips. Normally, when clips play in sequence, each clip buffers data (its preroll) when it starts to play. By grouping the sequence within a <par>
tag, though, RealSystem takes advantage of unused bandwidth to stream clips' preroll before the clips start to play. You can use this feature to mask preroll for high-bandwidth clips, for example, by streaming the preroll while low-bandwidth introductory clips play.
The following SMIL example, which omits the header that defines the region layout and base URL, shows how to mask preroll for high-bandwidth clips and create smooth transitions between the initial group of clips and the subsequent group of clips:
<body>
<par>
<seq>
<par>
<!-- group 1: introductory group masking preroll -->
<audio src="intro.rm"/>
<textstream src="titles.rt" region="left"/>
<textstream src="credits.rt" region="right"/>
</par>
<par>
<!-- group 2: main group with masked preroll -->
<ref src="graphics.rp" region="left"/>
<video src="story.rm" region="right"/>
</par>
</seq>
</par>
</body>
Group 1 consists of two RealText clips and a RealAudio clip played in parallel. Because of the <seq>
tag, the group 1 clips precede the RealPix and RealVideo clips in group 2. If the <seq>
tag were the highest level of organization, RealServer would stream the group 1 clips without regard to group 2, streaming data for group 2 clips only after group 1 had finished playing. Viewers would thus experience a delay after the group 1 clips finished playing, while RealServer streams preroll for the group 2 clips.
You can eliminate this delay, however, by inserting an outer <par>
tag, which is shown just below the <body>
tag in the preceding example. This tag makes RealSystem treat groups 1 and 2 as one large parallel group with subgroups played in sequence. Although this does not affect the order in which the clips play, the parallel grouping makes RealSystem balance bandwidth among all of the clips. After it starts to stream the group 1 clips, RealServer makes use of unused bandwidth by streaming data for group 2 clips while the group 1 clips play. This masks the preroll for the group 2 clips.
![]() |
Note |
---|
When you enclose clips in a <par> group, the individual
clips do not appear in the RealPlayer playlist.
|
![]() |
Additional Information |
---|
See "Buffering" and "Timelines for Multiclip Presentations". |
RealPlayer creates all regions defined in a SMIL file's header section when it first reads the file. Thus, a single SMIL presentation cannot play clips in a certain set of regions and then destroy those regions and create different regions with a new layout. You can use the <region>
tag's z-index
parameter, however, to create transparent, overlaying regions that give the impression of regions appearing and disappearing.
The following SMIL header example creates a left
region next to a right
region. Both regions are displayed in portrait orientation and are more than twice as high as they are wide. A second set of regions, top
and bottom
, are stacked. These two regions have higher z-index values, meaning that they display in front of the left
and right
regions, as indicated in this example:
<head>
<layout>
<root-layout width="360" height="360"/>
<!-- first two side-by-side regions -->
<regionid="left"
top="10" left="10" width="165" height="340"z-index="0"
/>
<regionid="right"
top="10" left="185" width="165" height="340"z-index="1"
/>
<!-- second two stacked regions -->
<regionid="top"
top="10" left="70" width="220" height="165"z-index="2"
/>
<regionid="bottom"
top="185" left="70" width="220" height="165"z-index="3"
/>
</layout>
</head>
As defined in the following SMIL body example, RealPix and RealText clips first play in the left
and right
regions, which appear behind the top
and bottom
regions. Because the overlaying top
and bottom
regions do not use background colors, they remain transparent until clips play in them. The introductory RealPix and RealText clips disappear when they finish playing, restoring to view the root-layout
default background color, black. The group 2 clips, a RealVideo clip and a second RealText clip, then play in the top
and bottom
regions, as shown in this example:
<body>
<par>
<seq>
<par>
<!-- group 1: side-by-side titles and credits -->
<ref src="titles.rp"region="left"
fill="remove"/>
<textstream src="credits.rt"region="right"
fill="remove"/>
</par>
<par>
<!-- group 2: stacked video and subtitles -->
<video src="story.rm"region="top"
/>
<textstream src="subtitles.rt"region="bottom"
/>
</par>
</seq>
</par>
</body>
Although the left
, right
, top
, and bottom
regions exist from the moment the SMIL file starts to play, the use of z-index
, fill="remove"
, and default region transparency makes it appear as if the regions are created dynamically with each new set of clips. The following illustration shows the initial region creation, the first set of clips, and then the second set of clips playing in the RealPlayer window.
![]() |
Additional Information |
---|
For more on z-index , see "Ordering Overlapping Regions
with z-index". "Laying Out Multiple Clips" discusses
SMIL layouts.
|
The SMIL <switch>
tag is a powerful feature with which you can specify options that each RealPlayer can choose between based on its preference settings and available bandwidth. "Switching Between Alternate Choices" explains the basics of using the <switch>
tag. This section provides tips on writing complex <switch>
statements.
With RealAudio or RealVideo clips encoded for multiple bit rates with SureStream technology, you may or may not need to use the <switch>
tag. The following guidelines will help you make this decision:
<switch>
tag.
<switch>
tag when combining a SureStream clip with other clips encoded for single bandwidths. The SureStream clip is always used, but the <switch>
group gives RealPlayer options for other clips. The following example illustrates a RealAudio SureStream clip and a choice between two RealPix presentations built for different bandwidths:
<par>
<audio src="audio/newsong2.rm"/>
<switch>
<ref src="image/slideshow1.rp" system-bitrate="47000"/>
<ref src="image/slideshow2.rp" system-bitrate="20000"/>
</switch>
</par>
![]() |
Additional Information |
---|
For more on SureStream, see "SureStream RealAudio and RealVideo". Refer to "Step 3: Develop a Bandwidth Strategy" for information on targeting certain network connection speeds. |
As described in "Different Window Sizes for Different Bandwidths", you can create different-size versions of the same video, streaming a small video window over slow modems and a larger window (or windows) over faster connections. Reducing the size for slower connections ensures that the video's frame rate and visual quality remain high. For example, you could create the three clips listed in the following table.
Each <switch>
tag test attribute uses the target bit rate of its clip's slowest SureStream stream. The <switch>
tag then presents the three RealVideo choices to RealPlayer from fastest to slowest:
<switch>
<video src="videobig.rm" system-bitrate="225000"/>
<video src="videomedium.rm" system-bitrate="45000"/>
<video src="videosmall.rm" system-bitrate="20000"/>
</switch>
![]() |
Additional Information |
---|
Target bit rates are listed in the table "Maximum Streaming Rates". |
You can use multiple <switch>
test attributes to have RealPlayer choose clips based on both bandwidth and language. There are two ways to do this. In this first example, each audio clip choice has two test attributesone for language and one for bandwidth. Both attributes must be viable for RealPlayer to choose the clip:
<switch>
<!-- French language choices -->
<audio src="sound/audio_fr2.rm" system-language="fr" system-bitrate="47000"/>
<audio src="sound/audio_fr1.rm" system-language="fr" system-bitrate="20000"/>
<!-- English language choices (default) -->
<audio src="sound/audio_en2.rm" system-bitrate="47000"/>
<audio src="sound/audio_en1.rm" system-bitrate="20000"/>
</switch>
Because RealPlayer evaluates the <switch>
choices from top to bottom, selecting the first viable option, the last two choices do not have system-language
options. This lets all RealPlayers other than those with French selected as their language preference choose between the two English-language clips.
The next example adds RealText clips in both French and English to the presentation possibilities. Here, <switch>
statements are nested so that RealPlayers with French set as their language preference play the French RealText clip and choose from the set of French-language RealAudio clips, based on available bandwidth. All other RealPlayers play the English RealText clip and choose from the set of English-language RealAudio clips:
<switch>
<!-- Choose French as the language -->
<par system-language="fr">
<textstream src="text/credits_fr.rt"/>
<switch>
<!-- Choose fast or slow bit rate for French audio -->
<audio src="sound/audio_fr2.rm" system-bitrate="47000"/>
<audio src="sound/audio_fr1.rm" system-bitrate="20000"/>
</switch>
</par>
<!-- Choose English (default) as the language -->
<par>
<textstream src="text/credits_en.rt"/>
<switch>
<!-- Choose fast or slow bit rate for English audio -->
<audio src="sound/audio_en2.rm" system-bitrate="47000"/>
<audio src="sound/audio_en1.rm" system-bitrate="20000"/>
</switch>
</par>
</switch>
Different versions of RealPlayer may have different features that affect which presentations they can play. RealPlayer G2 cannot use the caching and multiple-window features of RealPlayer 7 or later, for example. However, you can create different clips for different RealPlayer versions and then use a SMIL <switch>
tag to enable each RealPlayer to choose the correct clips to play.
A <switch>
tag can test for any number of RealPlayer versions from newest to oldest. It uses a system-required
test attribute to specify which versions of RealPlayer can play each choice. The last choice, which denotes the oldest version of RealPlayer you are considering, does not have a
system-required
attribute. A SMIL file with this type of <switch>
tag takes the following form:
<smil xmlns:cv="http://features.real.com/systemComponent">
<body>
<switch>
<seq system-required="cv" cv:systemComponent="...attribute to test...
">
...clips to play if RealPlayer satisfies the first test attribute...
</seq>
<seq system-required="cv" cv:systemComponent="...attribute to test...
">
...clips to play if RealPlayer satisfies the second test attribute...
</seq>
<seq>
...clips to play for the default choice, which has no test attribute...
</seq>
</switch>
</body>
</smil>
The <switch>
tag in this example enables RealPlayer to choose among three <seq>
groups, although RealPlayer could also choose among <par>
groups or individual clips. The final, default choice must always be included and must not use the system-required
test attribute.
![]() |
Tip |
---|
You will need a separate computer for each version of RealPlayer you are testing. Multiple versions of RealPlayer cannot reside on the same computer. |
<smil>
tag.
Although RealPlayer's implementation of SMIL does not typically need an XML namespace declaration, the use of systemComponent
as a test attribute requires the following declaration:
<smil xmlns:cv="http://features.real.com/systemComponent">
You must declare the namespace exactly as shown above. This declaration informs RealPlayer that the SMIL file uses the XML extension systemComponent
. The declaration includes the following components:
<switch>
tag that uses the proper system-required
and systemComponent
syntax. Within the <switch>
tag, you include a system-required
test attribute that takes the following form:
system-required="cv" cv:systemComponent="http://features.real.com/?feature;player=6.0.7.x"
The components of the test attribute are as follows:
![]() |
Note |
---|
The RealPlayer version number is the only part of the
systemComponent syntax you should change.
|
As explained in "Caching Files on RealPlayer", RealPlayer 7 or later can cache downloaded image files, but RealPlayer G2 cannot. The following example is a SMIL <switch>
tag that causes RealPlayer 7 or later to download and cache two logo files. If RealPlayer G2 requests this SMIL file, it simply downloads the logo files. This example is a variation of the SMIL file described in "Authoring SMIL Files for Caching".
<smil xmlns:cv="http://features.real.com/systemComponent">
<body>
....
<switch>
<seq system-required="cv"
cv:systemComponent="http://features.real.com/?feature;player=6.0.7.380">
<!-- For RealPlayer 7 or later, download and cache these two logos" -->
<img src="chttp://www.company.com/images/logo1.gif?bitrate=20000"
region="logo1" fill="freeze"/>
<img src="chttp://www.company.com/images/logo2.gif?bitrate=20000"
region="logo2" fill="freeze"/>
</seq>
<seq>
<!-- For RealPlayer G2, download these two logos" -->
<img src="http://www.company.com/images/logo1.gif?bitrate=20000"
region="logo1" fill="freeze"/>
<img src="http://www.company.com/images/logo2.gif?bitrate=20000"
region="logo2" fill="freeze"/>
</seq>
</switch>
</body>
</smil>
When evaluating this <switch>
statement, RealPlayer 7 or later chooses the first <seq>
group. (The version number shown above, 6.0.7.380
, is the Gold release of RealPlayer 7.) RealPlayer G2, on the other hand, ignores the first <seq>
group and chooses the second <seq>
group, which has no test attribute.
"Popping Up New RealPlayer Windows" explains how RealPlayer 7 or later can open presentations in new windows. RealPlayer G2 uses only one window, however. The following SMIL <switch>
tag presents RealPlayer with a choice between two RealText files. The first RealText file contains hyperlinks that launch clips in new RealPlayer windows. The second RealText file, written for RealPlayer G2, plays clips in the main RealPlayer window:
<smil xmlns:cv="http://features.real.com/systemComponent">
<body>
....
<switch>
<!-- RealText clip to play with RealPlayer 7 or later. -->
<textstreamsystem-required="cv" cv:systemComponent=
"http://features.real.com/?feature;player=6.0.7.380"
src="rtsp://realserver.company.com/realtext/navigateRP7.rt
region="text" fill="freeze"/>
<!-- RealText clip to play with RealPlayer G2. -->
<textstream
src="rtsp://realserver.company.com/realtext/navigateG2.rt
region="text" fill="freeze"/>
</switch>
....
</body>
</smil>
The RealPlayer preferences dialog includes an option to enable captions for the hearing impaired. To compose these captions, write a RealText clip that coordinates text with the audio timeline and then create a SMIL file that plays the two in parallel. As shown in the following example, the SMIL attribute system-captions="on"
causes the captions to appear only if the viewer's preferences enable captions:
<smil>
<head>
<layout>
<root-layout background-color="blue" width="310" height="200"/>
<region id="video" width="176" height="132" left="67" top="5"/>
<region id="captions" width="300" height="50" left="4" top="145"/>
</layout>
</head>
<body>
<par>
<video src="news.rm" region="video"/>
<textstream src="captions.rt" region="captions"system-captions="on"
/>
</par>
</body>
</smil>
In this example, the RealText clip (captions.rt) appears only for viewers who have enabled captions in RealPlayer. For all other viewers, the caption region displays only the root-layout
region's background color. RealPlayer's caption setting does not affect the video clip, which has no system-captions
value. The following sections explain how to fill the caption region or make it disappear when captions are turned off.
![]() |
Tip |
---|
The system-captions attribute also works for <seq> and
<par> groups. You can use system-captions="off" to cause
a clip or group to play only when system captions are
turned off in RealPlayer.
|
![]() |
Additional Information |
---|
"Laying Out Multiple Clips" discusses SMIL layouts. RealText Authoring Guide is available at http://service.real.com/help/library/encoders.html. The RealPlayer online help can assist you with turning captions on and off in the preferences. |
To avoid displaying a blank region when captions are turned off, you can display another file, such as an image file, in the caption region. The following excerpt is from a SMIL file that uses the same layout as the preceding example. Here, the parallel group includes an image clip with a system-captions="off"
attribute. This causes the image to display only when captions are turned off in RealPlayer:
<par>
<video src="news.rm" region="video"/>
<textstream src="captions.rt" region="captions" system-captions="on"/>
<img src="filler.gif" region="captions"system-captions="off"
/>
</par>
Any clipnot just a static imagecan fill the captions region when captions are turned off. However, the filler clip should be the same size as the RealText captions clip when the two display in the same region.
As an extension to SMIL, RealPlayer supports the use of the system-captions
attribute in layout tags. This lets you change layouts when captions are displayed. The following SMIL file centers a video region above a caption region only when captions are turned on for RealPlayer:
<smil>
<head>
<meta name="title" content="Closed-Captioned News"/>
<!-- Layout used when captions are on. -->
<layoutsystem-captions="on"
>
<root-layout background-color="blue" width="310" height="200"/>
<region id="video" width="176" height="132" left="67" top="5"/>
<region id="captions" width="300" height="50" left="4" top="145"/>
</layout>
</head>
<body>
<par>
<video src="news.rm"system-captions="off"
/>
<video src="news.rm" region="video"system-captions="on"
/>
<textstream src="captions.rt" region="captions"system-captions="on"
/>
</par>
</body>
</smil>
With this SMIL file, RealPlayer creates the layout and plays the RealText clip in parallel with the video only when captions are on. When captions are off, RealPlayer defines no regions and plays only the news.rm clip that includes the system-captions="off"
attribute. When captions are off, the SMIL file is equivalent to the following:
<smil>
<head>
<meta name="title" content="Closed-Captioned News"/>
</head>
<body>
<video src="news.rm" system-captions="off"/>
</body>
</smil>