Chapter 4: Windows Media: ASF Stream Director Files (ASX)
Example 1 - Playlists
Example 2 - Server or Protocol Rollover
Example 3 - Overriding metadata of .ASF-file
Example 4 - Advertising
Example 5 - Handling events
Links: Windows Media ASX files
|
MSDN: All About Windows Media Metafiles
MSDN article about all important functions of ASX files.
Go
|
|
Ad Insertion Using Windows Media Technologies
This MSDN article discusses how to insert ads into a playlist and how to expand the idea to use dynamic ad personalization using Active Server Pages (ASP) technology.
Go
|
|
Windows Media Playback in a Web Page
Web Developers Virtual Library: A good resource about how to write even complex ASX files.
Go
|
Example 1 - Playlists
This is a simple ASX file where you can see the basic syntax elements and how to arrange them to get a playlist. Windows Media Player plays every entry after another.
|
Source code:
|
|
<ASX>
<ENTRY>
<REF href="mms://tov.video.t-online.de/tvision/dreamworks/F/wm/itv-spi-20031024-544-ver00-minrity-trailFW10000044465.wmv"/>
</ENTRY>
<ENTRY>
<REF href="mms://tov.video.t-online.de/tvision/mgm/F/wm/itv-spi-20031107-544-ver00-species-trailFW10000045381.wmv"/>
</ENTRY>
<ENTRY>
<REF href="mms://tov.video.t-online.de/tvision/mgm/F/wm/itv-spi-20031120-544-ver00-schnapptsho-trailFW10000045695.wmv"/>
</ENTRY>
</ASX>
|
|
|

Example 2 - Server or Protocol Rollover
ASX can additionally fullfill another important function. Connection problems due to connectivity on user side can be prevented. When the first REF-element of an entry cannot be accessed (for example because a firewall blocks all MMS traffic) the player rolls over automatically to an alternate content specified in the next element of the entry.
In the example this is simulated: the first element doesnot exist on the server. The second cannot be accessed due to missing MMS support of the server, but the player will most likely automatically switch to HTTP streaming. If this also fails the third and last entry (hopefully) will work.
|
Source code:
|
|
<ASX>
<ENTRY>
<REF href="/media/notexistent.wmv"/>
<REF href="mms://www.streaming-media.info/media/wm9_bb.wmv"/>
<REF href="http://www.streaming-media.info/media/wm9_bb.wmv"/>
</ENTRY>
</ASX>
|
|
|

Example 3 - Overriding metadata of .ASF-file
With ASX it is possible to define metadata as well for the entire presentation as every entry in it. Among others this includes title, author, copyright and rating. This data is displayed in Windows Media player or be accessed via JavaScript or VBScript.
The metadata of the ASX file alway overrides the metadata of the original streams referenced by the ASX file.
|
Source code:
|
|
<ASX Version="3.0">
<TITLE> "Sample presentation" </TITLE>
<AUTHOR> "Tobias Kuenkel" </AUTHOR>
<COPYRIGHT> "(c)2003 Tobias Kuenkel" </COPYRIGHT>
<ENTRY>
<TITLE> "Sample clip No 1"</TITLE>
<AUTHOR> "Peter Meier" </AUTHOR>
<COPYRIGHT> "(c)2000 PM" </COPYRIGHT>
<REF href="mms://tov.video.t-online.de/tvision/dreamworks/F/wm/itv-spi-20031024-544-ver00-minrity-trailFW10000044465.wmv"/>
</ENTRY>
<ENTRY>
<TITLE> "Sample clip No 2"</TITLE>
<AUTHOR> "Hans Mueller" </AUTHOR>
<COPYRIGHT> "(c)2000 HM" </COPYRIGHT>
<REF href="mms://tov.video.t-online.de/tvision/mgm/F/wm/itv-spi-20031107-544-ver00-species-trailFW10000045381.wmv"/>
</ENTRY>
</ASX>
|
|
|

Example 4 - Advertising
A simple example of ad insertion in a stream is displayed below. For example we could insert an ad clip into a livestream every 20 seconds.
In a more advanced setup we could use events fired by the liveencoder to insert advertisements at specific times (see below).
|
Source code:
|
|
<ASX Version="3.0">
<TITLE> "Sample presentation" </TITLE>
<AUTHOR> "Tobias Kuenkel" </AUTHOR>
<COPYRIGHT> "(c)2003 Tobias Kuenkel" </COPYRIGHT>
<REPEAT>
<ENTRY>
<TITLE> "ResearchChannel Live (LAN)"</TITLE>
<AUTHOR> "ResearchChannel" </AUTHOR>
<COPYRIGHT> "© 2000 ResearchChannel" </COPYRIGHT>
<REF href="mms://media-wm.cac.washington.edu/UWTV Live (LAN)"/>
<DURATION Value="0:20" />
</ENTRY>
<ENTRY>
<TITLE> "Advertisement"</TITLE>
<AUTHOR> "Hans Mueller" </AUTHOR>
<COPYRIGHT> "(c)2000 HM" </COPYRIGHT>
<REF href="http://www.streaming-media.info/media/wm_ad.wmv"/>
</ENTRY>
</REPEAT>
</ASX>
|
|
|

Example 5 - Handling events
As we have seen in the book the Windows Media Encoder can code script commands into an audio/video stream that can be handled by ASX. Script commands are composed out of a type-field and a variable. If the player fetches an event that is handled in the ASX-file we can use this to switch the stream, insert banners, open websites, etc.
|
Source code:
|
|
<ASX Version="3.0">
<Logo href = "http://servername/path/icon.jpg" style = "ICON" />
<Logo href = "http://servername/path/mark.jpg" style = "MARK" />
<Base href= "http://samples.company.com/" />
<MoreInfo href = "http://www.company.com/product" />
<ENTRY>
<TITLE> "Livestream" </TITLE>
<REF href="mms://media-wm.cac.washington.edu/UWTV Live (LAN)"/>
</ENTRY>
<EVENT Name="Werbung" Whendone="RESUME">
<ENTRY ClientSkip = "no">
<TITLE> "Advertisement" </TITLE>
<REF href="http://www.streaming-media.info/media/wm_ad.wmv"/>
<Banner href="http://AdServer/Path/Banner1.gif">
<MoreInfo href = "http://www.company.com/" />
<Abstract>This is a tooltip for the ad.</Abstract>
</Banner>
</ENTRY>
</EVENT>
<ASX>
|
|