RealSystem's advertising extension and SMIL make it easy to insert advertisements into your streaming presentation. You can include GIF ad banners, for example, or have a video ad precede each requested clip. This chapter explains how to place ads in SMIL presentations. Before you start, you should understand SMIL, as described in Chapter 6.
To use RealSystem's advertising extension, you create a SMIL file that lays out requested clips and ad clips. Instead of listing ad clip URLs in SMIL tags such as <img/>
or <video/>
, you write <RealAdInsert/>
tags that cause RealServer to insert ad URLs automatically. RealServer typically gets these ad URLs from a third-party ad server. RealSystem can deliver ads in any format played by RealPlayer, including GIF, animated GIF, JPEG, PNG, RealAudio, RealVideo, and Flash.
The URL used to request the SMIL filenot the <RealAdInsert/>
tagdetermines what type of ad appears in place of each <RealAdInsert/>
tag. For example, your Web page might contain a hyperlink to a SMIL file that looks like the following:
<a href="http://realserver.example.com/ramgen/adtag/banner/start.smil">...</a>
Here, the URL component /adtag/banner/
indicates that the SMIL file contains one or more <RealAdInsert/>
tags that RealServer replaces with ad URLs. The RealServer administrator might define /adtag/banner/
to mean that each <RealAdInsert/>
tag is replaced by a single 486-pixel-by-60-pixel banner ad. A URL component such as /adtag/rotating_banner/
might indicate banner ads that rotate every 30 seconds. Another component such as /adtag/lead_in/
might be for RealVideo ads that precede the requested content.
To use RealSystem's advertising extension, you need to work closely with your RealServer administrator. The administrator can tell you the sizes and file formats of ads available for streaming, the URLs you will need to use in your Web pages, and other important information. RealServer can also generate SMIL files containing ads, or insert ads in existing SMIL presentations. This lets you serve ads for existing content without having to write or modify SMIL files.
RealServer can stream a single banner ad or a series of rotating banner ads within a SMIL presentation. Each ad includes a hyperlink that, when clicked, opens the URL in the viewer's Web browser. The RealServer administrator defines the banner ad size and determines how much bandwidth each ad uses. For rotating banner ads, the administrator also determines how frequently RealPlayer displays a new ad.
![]() |
Note |
---|
Before creating SMIL files with banner ads, check with the administrator on banner ad size, bandwidth, type (single ad or rotating ads), and rotation frequency. |
To integrate banner ads with your presentation, you create a SMIL region in which the ad image or rotating image series is displayed. The SMIL file in the following example creates an ad banner region above a video region. The video region is 320 pixels wide by 240 pixels high. The ad banner region is 468 pixels wide by 60 pixels high, which is a common size for ad banners. In the SMIL body section, a <par>
group plays the requested video and banner ads in their respective regions:
<smil>
<head>
<!--presentation with video clip and ad banner-->
<layout>
<root-layout width="488" height="330" background-color="black"/>
<region id="ad_banner" top="10" left="10" width="468" height="60"/>
<region id="videoregion" top="80" left="84"width="320" height="240"/>
</layout>
</head>
<body>
<par>
<RealAdInsert region="ad_banner" dur="9:00.0" fill="freeze"/>
<video src="rtsp://realserver.example.com/videos/newsvid.rm"
region="videoregion"/>
</par>
</body>
</smil>
The following illustration shows this layout of a banner ad region above a requested video clip.
![]() |
Additional Information |
---|
"Laying Out Multiple Clips" explains how to set up SMIL regions. |
In the SMIL file body, instead of including an <img/>
tag link to an ad image file, you use a <RealAdInsert/>
tag that triggers automatic ad insertion. In the preceding SMIL example, the ad insertion tag looks like this:
<RealAdInsert region="ad_banner" dur="9min" fill="freeze"/>
When RealPlayer requests a SMIL file that contains an ad insertion tag, RealServer replaces the <RealAdInsert/>
tag with a SMIL <img/>
tag that includes a src
attribute pointing to a banner ad or, with ad rotation, to a series of banner ads. The <RealAdInsert/>
tag can also contain SMIL attributes such as region="ad_banner"
and fill="freeze"
. RealServer simply includes these SMIL attributes in the replacement <img/>
tag. You need to specify a duration time only when using rotating banner ads.
To use rotating banner ads with a live broadcast, do not set a duration time in the <RealAdInsert/>
tag. This way RealServer will send new banner ads to RealPlayer as long as it plays the broadcast. For prerecorded content, however, set a duration that is approximately equal to the length of the broadcast. If the requested content is 9 minutes long, for example, you would set the ad duration as dur="9min"
.
You specify an ad rotation duration when serving prerecorded content so that RealSystem can calculate the presentation length. If you set no duration, RealServer assumes that you want a continuous ad stream for a live broadcast, and it disables RealPlayer's clip position slider. RealServer then sends new ads until the viewer halts the presentation. Although the presentation will play OK, the viewer will not be able to fast-forward or rewind it.
You can set the ad duration shorter than the requested content if you do not want ads to display for the entire length of the presentation. In this case, use a fill="remove"
or fill="freeze"
attribute in the <RealAdInsert/>
tag to specify whether you want the last ad banner to disappear or remain on-screen.
Do not set the ad duration significantly longer than the length of the content, however. RealSystem considers the ad duration when calculating the presentation's total running time. If you set an ad duration of 20 minutes for a 10-minute video, for example, RealPlayer indicates in its status bar that the presentation lasts 20 minutes. If a viewer then moves the RealPlayer clip position slider forward to the 15-minute mark, for instance, the video will stop, possibly leading the viewer to conclude that the presentation is flawed.
![]() |
Additional Information |
---|
See "Specifying Timing" for more on SMIL timing values. |
Audio, video, and animation are quickly gaining popularity as advertising media, with many ad-serving companies offering media ads in formats such as RealVideo and Flash. With RealSystem's advertising capability, you can play media ads before, between, or within requested clips. To do this, you create a SMIL file that defines when and how ads appear in relation to requested clips. Instead of supplying URLs to ad clips, you write <RealAdInsert/>
tags that cause RealServer to insert media ads automatically.
![]() |
Tip |
---|
Always account for the higher bandwidth requirements of media ads, and make sure that your target audience has sufficient bandwidth to receive the ad as well as the requested clips. For more on bandwidth, see "Step 3: Develop a Bandwidth Strategy". |
To use media advertising, create a SMIL file that organizes all clips, whether they are ad clips or requested content. For a media ad, use a <RealAdInsert/>
tag in place of a clip source tag such as <video/>
. Media ads typically play before or between requested clips. The number, placement, and timing of media ads depend entirely on how you construct the SMIL file.
The following SMIL file has no layout. It simply plays two video clips in sequence (the first clip is the media ad):
<smil>
<body>
<seq>
<RealAdInsert/>
<video src="rtsp://realserver.example.com/video/video.rm"/>
</seq>
</body>
</smil>
In the preceding example, the lack of SMIL regions causes the RealPlayer display window to resize automatically for each clip. To prevent resizing, or to lay out clips that play together, define SMIL regions for the clips. The following is an example of one video region defined for two clips played in sequence:
<smil>
<head>
<layout>
<root-layout width="240" height="180"/>
<region id="videoregion" width="240" height="180"/>
</layout>
</head>
<body>
<seq>
<RealAdInsertregion="videoregion"
/>
<video src="rtsp://realserver.example.com/video/video.rm"region="videoregion"
/>
</seq>
</body>
</smil>
The <RealAdInsert/>
tag in the preceding example includes the SMIL region
attribute to associate the ad with the correct SMIL region. You can include other SMIL attributes, such as the dur
or fill
attribute, in a <RealAdInsert/>
tag as well.
![]() |
Additional Information |
---|
"Laying Out Multiple Clips" explains how to set up SMIL regions. |
When a media ad and a requested clip play in sequence, the viewer can skip the ad by choosing the requested clip in the RealPlayer playlist. To disable the playlist through SMIL, enclose the <seq>
group within <par>
and </par>
tags, as in this example:
<smil>
<body>
<par>
<seq>
<RealAdInsert/>
<video src="rtsp://realserver.example.com/video/video.rm"/>
</seq>
</par>
</body>
</smil>
![]() |
Note |
---|
The use of the <par> group also helps reduce the second
clip's preroll, as explained in "Smoothing Transitions
Between Clips".
|
![]() |
Additional Information |
---|
For more on the RealPlayer playlist, see "Managing the Playlist". |
By using SMIL's clip-timing commands, you can insert media ads within a requested clip. The following example inserts three media ads into a long video called news.rm. The effect is similar to a television program with commercial breaks:
<smil>
<head>
<layout>
<root-layout width="240" height="180"/>
<region id="videoregion" width="240" height="180"/>
</layout>
</head>
<body>
<par>
<seq>
<video src="news.rm" region="videoregion" clip-end="8.5min"/>
<RealAdInsert region="videoregion"/>
<video src="news.rm" region="videoregion" clip-begin="8.5min" clip-end="16.75min"/>
<RealAdInsert region="videoregion"/>
<video src="news.rm" region="videoregion" clip-begin="16.75min" clip-end="24.5min"/>
<RealAdInsert region="videoregion"/>
<video src="news.rm" region="videoregion" clip-begin="24.5min"/>
</seq>
</par>
</body>
</smil>
As shown in the preceding example, the three ad clips and the main video clip, news.rm, are in a <seq>
group. The news.rm video starts at its actual beginning and plays for 8.5 minutes. It then stops while the first ad plays. The news.rm clip then resumes where it left off, stopping again at later intervals for the second and third ads. Because the ad clips include no SMIL timing commands, each one plays from beginning to end without stopping. RealServer delivers a new video ad for each <RealAdInsert/>
tag.
![]() |
Additional Information |
---|
For more on clip timing, see "Setting Internal Clip Begin and End Times". |