previous next

Chapter 9: Inserting Ads in a Presentation

SMIL makes it easy to include advertisements in your streaming presentation. You can lay out ad banners, supply ad URLs, and even specify the times when ads appear. This chapter provides examples of how you can use SMIL to include ads in your presentations. Before you start, you should have a thorough understanding of SMIL as described in Chapter 7.

Placing Ads in Presentations

With RealSystem G2, you can create ads in any format, whether video, audio, animation, or JPEG or GIF images. Using SMIL, you simply treat your ads the same way you treat your media clips. You lay out your presentation and time when each media clip and ad appears. Because a SMIL file lists separate URLs to each clip, your ads can be on any server, whether RealServer, a Web server, or an ad server. And because a SMIL file is a plain text file, you can dynamically generate it by any means to present different ads for each page visitor.

Using an Ad Banner

The following example creates a video region with an ad banner above it. When a user plays the presentation, the video plays uninterrupted while ads appear in the ad banner twice a minute. The video and ads are defined to play at the same time in a <par> group. Within that <par> group, ads are nested within a <seq> group and are each defined to stay onscreen for 30 seconds. Each ad links to a different HTML page that displays in the browser when the user clicks the ad graphic.


<smil>
<head>
<!--presentation with video clip and ad banner-->
<layout>
<root-layout width="330" height="330" background-color="black"/>
<region id="adbanner" top="5" left="5" width="320" height="72"/>
<region id="videoregion" top="85" left="5"width="320" height="240"/>
</layout>
</head>
<body>
<par>
<video src="newsvid.rm" region="videoregion"/>
<par>
<seq>
<!--Display new linked ad banner every 30 seconds-->
<a href="http://www.company.com/ads/offer1.htm" show="new">
<img src="ad1.gif" region="adbanner" dur="30s"/></a>
<a href="http://www.company.com/ads/offer2.htm" show="new">
<img src="ad2.gif?bitrate=1000" region="adbanner" dur="30s"/></a>
<a href="http://www.company.com/ads/offer3.htm" show="new">
<img src="ad3.gif?bitrate=1000" region="adbanner" dur="30s"/></a>
<a href="http://www.company.com/ads/offer4.htm" show="new">
<img src="ad4.gif?bitrate=1000" region="adbanner" dur="30s"/></a>
</seq>
</par>
</par>
</body>
</smil>
Ad Banner Layout

Additional Information
"Laying Out Multiple Clips" explains how to set up regions. SMIL hyperlinking is described in "Linking to Other Media". For more on the image bitrate options, see "Defining Image Options".

Inserting Ads in a Clip

The following example inserts three ad videos into a long video called news.rm. The effect is like a television program with commercial breaks. Each ad video links to an HTML page that displays in the browser when the user clicks the ad:


<smil>
<head>
<!--video clip with commercial breaks-->
<meta name="author" content="Jane Morales"/>
<meta name="title" content="Technology in the News"/>
<meta name="copyright" content="(c)1998 Jane Morales"/>
</head>
<body>
<seq>
<video src="news.rm" clip-end="8.5min"/>
<a href="http://www.company.com/ads/offer1.htm" show="new">
<video src="commercial1.rm"/></a>
<video src="news.rm" clip-begin="8.5min" clip-end="16.75min"/>
<a href="http://www.company.com/ads/offer2.htm" show="new">
<video src="commercial2.rm"/></a>
<video src="news.rm" clip-begin="16.75min" clip-end="24.5min"/>
<a href="http://www.company.com/ads/offer3.htm" show="new">
<video src="commercial3.rm"/></a>
<video src="news.rm" clip-begin="24.5min"/>
</seq>
</body>
</smil>

As shown above, the three ad clips and the main video clip, news.rm, are in a <seq> group. The news.rm video begins at its normal beginning and plays for 8.5 minutes. It then stops while the commercial1.rm ad plays. The news.rm clip then resumes where it left off, breaking at later intervals for commercial2.rm and commercial3.rm. Because no timing elements are specified for the ads, they play from their normal beginnings to normal ends and may be any length.

Additional Information
For more on clip timing, see "Setting Internal Clip Begin and End Times". SMIL hyperlinking is described in "Linking to Other Media".

Tips on Inserting Ads in Clips

The following tips will help you create smoother transitions between media and ad clips:

Using RealPix for Ads

Instead of streaming ads to RealPlayer directly through SMIL, you can use RealPix to assemble JPEG and GIF images into ad presentations. Using RealPix gives you these advantages over streaming images directly through SMIL:

As described in RealPix Authoring Guide, the RealPix file contains mark-up that specifies the locations of image files and creates the desired transitions. Within the presentation SMIL file, you simply link to the RealPix file and assign it to appear in the appropriate region. The following example is the same as that used in "Using an Ad Banner", except the individual GIF ads have been replaced with RealPix:


<smil>
<head>
<!--presentation with video clip and ad banner-->
<layout>
<root-layout width="330" height="330" background-color="black"/>
<region id="adbanner" top="5" left="5" width="320" height="72"/>
<region id="videoregion" top="85" left="5"width="320" height="240"/>
</layout>
</head>
<body>
<par>
<video src="newsvid.rm" region="videoregion"/>
<ref src="adrotation.rp" region="adbanner"/>
</par>
</body>
</smil>

Additional Information
For more on RealPix, get RealPix Authoring Guide from http://service.real.com/help/library/index.html.


Copyright © 1998 RealNetworks
For information on RealNetworks' technical support, click here.
Comments on this document? Click here.
This file last updated on 12/18/98 at 14:36:38.
previous next