Share via


Replacing Ads in a Playlist

banner art

Previous Next

Replacing Ads in a Playlist

If you are using a Windows Media server to stream a presentation that you are simultaneously broadcasting on radio or television, you can replace the broadcast advertisements with Internet-based ads. Radio stations often do this to comply with American Federation of Television and Radio Artists (AFTRA) rules. The following discussion assumes that you are encoding the live broadcast by using Windows Media Encoder.

Assume that a client connects to a broadcast publishing point associated with the following playlist.

<?wsx version="1.0"?>
<smil>
  <excl>
    <priorityClass peers="pause">
       <media src="https://encoder_name:8080" begin="0" />
       <media src="c:\wmpub\wmroot\Ad_1.wmv" begin="Encoder_Event" />
    </priorityClass>
  </excl>
</smil>

The first media element directs the server to connect to port 8080 on the computer running Windows Media Encoder and receive the encoded content. However, because the peers attribute on the priorityClass element is set to "pause", the first element pauses when the second starts, and resumes playing after the second media element ends. The second element replaces a broadcast ad and starts when it receives an event notice named Encoder_Event. You send the event notice by inserting a custom script command into the stream sent by Windows Media Encoder. A script command is a name/value pair. The value is always a string that you choose. The name must be one from the following table.

Name Description
FIRE_EVENT Indicates that the playlist must switch to the media element that contains a begin attribute associated with the event notice. This is similar to the FireEvent method on the IWMSPlaylist interface.
CUE_EVENT Indicates that the server must prepare the next stream in the queue. This is similar to the CueStream method on the IWMSPlaylist interface.
UNCUE_EVENT Indicates that the content previously prepared for streaming must be uncued. This is similar to the UncueStream method on the IWMSPlaylist interface.

In the preceding playlist example, the name of the custom script command is FIRE_EVENT, and the value is Encoder_Event. You can insert this name/value pair into the encoded stream by using either the Windows Media Encoder administration interface or the Windows Media Encoder SDK. For more information, see the Microsoft Web Site.

See Also (General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)

Previous Next