This appendix will help you utilize the many features of RealSystem and SMIL. Before following the production tips given here, make sure you have a good understanding of SMIL as described in Chapter 7.
RealPlayer 7 has a View>Clip Source command that shows the SMIL mark-up of the presentation currently playing. The RealServer or Web server hosting the presentation sends the mark-up as an HTML page that opens in your default Web browser. This feature lets you examine SMIL presentations to learn how they are laid out and timed.
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 file source, or allow access to the source 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 a 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. When clips normally 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 send clips' preroll before they start to playback. 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 and subsequent 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 finished. Viewers would experience a delay after group 1 clips finished as RealServer streamed preroll for group 2 clips.
The outer <par> tag just below the <body> tag, however, makes RealSystem treat groups 1 and 2 as one large parallel group with subgroups played in sequence. Although this doesn't affect the order in which the clips play, the parallel grouping makes RealSystem balance bandwidth between all 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 "What is Preroll?" and "Developing Multiclip Presentations". |
RealPlayer creates all regions defined in a SMIL file's header section when it first reads the file. So a single SMIL presentation cannot play clips in a certain set of regions, then destroy those regions and create different regions with a new layout. To accomplish dynamic layout changes, you can create separate SMIL files that define each region set, then play the SMIL files in sequence as described in "Creating a Ram File Manually".
An alternative is to create a single SMIL file that uses the <region> tag's z-index parameter to create transparent, overlaying regions. The following SMIL header example creates a left region next to a right region. Both are in portrait orientation, their heights over twice the value of their widths. A second set of regions, top and bottom, are stacked. These regions have higher z-index values, meaning that they display in front of the left and right regions:
<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, RealPix and RealText clips first play in the left and right regions, which appear beneath 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 playback, restoring to view the root-layout default background color of black. The group 2 clips, a RealVideo clip and another RealText clip, then play in the top and bottom regions:
<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 start of the SMIL file playback, 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 figure illustrates the initial region creation, the first set of clips, 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 that lets you 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. The following sections give 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:
<switch> group.
<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 "Choosing RealAudio Codecs" and "Choosing RealVideo Codecs". Refer to "Supporting Multiple Bandwidth Connections" for more on developing presentations for different connection speeds. |
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-attributes, one 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 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 a set of English-language RealAudio clip:
<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, for example. However, you can create different clips for different RealPlayer versions, then use a SMIL <switch> tag to let each RealPlayer choose the correct clips to play.
A <switch> tag can test for any number of RealPlayer versions in order from newest to oldest. It uses a system-required test attribute to specify which version of RealPlayer can play each choice. The last choice, which is meant for the oldest RealPlayers you're considering, does not have a system-required attribute. A SMIL file with this type of <switch> tag uses this general 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 sample <switch> tag above lets RealPlayer choose between three <seq> groups, though RealPlayer could also choose between <par> groups or individual clips. The final, default choice must always be included and must not use the system-required test attribute.
|
|
Tip |
|---|
| You'll need a separate computer for each version of RealPlayer you're testing. Multiple versions of RealPlayer cannot reside on the same machine. |
<smil> tag.
Although RealPlayer's implementation of SMIL does not typically need a XML namespace declaration, the use of systemComponent as a test attribute requires the following declaration:
<smil xmlns:cv="http://features.real.com/systemComponent">
The namespace must be declared exactly as shown above. This declaration informs RealPlayer that the SMIL file uses the XML extension systemComponent. The declaration has the following components:
Write a <switch> tag with the proper system-required and systemComponent syntax. Within the <switch> tag, you include a system-required test attribute that has this 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, such as 6.0.7.362, is the only
part of the systemComponent syntax you should change.
|
As explained in "Caching Images Files", RealPlayer 7 can cache downloaded image files, but RealPlayer G2 cannot. The following example is a SMIL <switch> tag that causes RealPlayer 7 to download and cache two logo files. If RealPlayer G2 requests this SMIL file, it simply downloads the logo files. This extract revises the SMIL file described in "Authoring SMIL Files for Caching".
<smilxmlns:cv="http://features.real.com/systemComponent">
<body>
....
<switch>
<seqsystem-required="cv">
cv:systemComponent="http://features.real.com/?feature;player=6.0.7.362"
<!-- For RealPlayer 7, 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 chooses the first <seq> group. For the actual version number, shown above as 6.0.7.362, use the version number from your RealPlayer 7. RealPlayer G2 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 can launch 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 has 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. -->
<textstreamsystem-required="cv" cv:systemComponent="http://features.real.com/?feature;player=6.0.7.362"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.rtregion="text" fill="freeze"/>
</switch>
....
</body>
</smil>
The RealPlayer preferences window has an option to enable captions for the hearing impaired. To author these captions, write a RealText clip that coordinates text with the audio timeline. Then create a SMIL file that plays the two in parallel. The SMIL attribute system-captions="on" makes the captions 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 shows the root-layout region's background color. RealPlayer's captions setting does not affect the video clip, which has no system-captions value. Following sections explain how to fill the caption region or make it disappear when captions are off.
|
|
Tip |
|---|
The system-captions attribute also works for <seq> and
<par> groups. You can use system-captions="off" to make
a clip or group 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 a blank region when captions are off, you can display another file, such as an image file, in the caption region. The following extract is from a SMIL file that uses the same layout as the previous example. Here, the parallel group includes an image clip with a system-captions="off" attribute. This makes the image 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 clip, not just a static image, can fill the captions region when captions are off. The filler clip should be the same size as the RealText captions clip, however, when the two display in the same region.
As an extension to SMIL, RealPlayer supports system-captions in layout tags. This lets you change layouts when captions are displayed. The following SMIL file centers a video region above a captions region only when RealPlayer enables captions. Although this example uses system-captions in the <layout> tag, you could use the attribute in <root-layout/> and <region/> tags as well to display or hide individual regions based on RealPlayer's captions setting:
<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>