Updated February 4, 1999
ASX files are simply text files that act as links from Web pages to ASF files on Windows Media Services or HTTP servers. They transfer control of the data from the HTTP browser to the Windows Media Player so that the data can stream.
When a user hits a link to an ASX file, the user's browser downloads the entire ASX file to the user's cache directory (don't worry, the files are tiny -- about 1K in size). Then the user's computer looks in its file associations table and sees that when it hits an ASX file it should launch the Windows Media Player. The Windows Media Player launches, looks in the ASX for instructions on where to get the ASF file, and then starts the stream playing.
If you have an ASF file that you want users to be able to access, creating an ASX file is simple. This ASX file can be used to access on-demand ASF files, ASF files that contain live audio or video streams generated from a Windows Media Encoder, or Windows Media Services Station (.NSC) files.
To get started and create your first ASX, just go into your favorite text editor, such as Notepad, and type the following:
<ASX version="3"> <Entry> <ref HREF="path"/> </Entry> </ASX>
Just substitute the path of the ASF file you have, where path is one of the following, depending on where you are streaming the content from:
Source of ASF | Syntax |
---|---|
ASF on Windows Media Services | mms://servername/path/asfname.asf |
Windows Media station | http://servername/stations/kxyz.nsc |
Publishing point on Windows Media Services | mms://servername/publishingpoint/ |
ASF on HTTP server | http://servername/path/asfname.asf |
ASF on network server | file://\\servername\path\asfname.asf |
ASF on local hard drive | file://c:\path\asfname.asf |
Once you've entered this into Notepad, save the file as filename.asx. Check to make sure that the ASX is working by double-clicking on it in Windows Explorer. It should bring up the Windows Media Player and start the content streaming. Once you've tested that it's working, just save it to your standard HTTP server along with your HTML pages, and link to it by means of a normal <a href> tag, or embed it in an HTML page using the Windows Media <OBJECT> tag.
When you play content served by Windows Media Technologies, you can right-click on the viewing area or video rendering area, and a drop-down menu will come up. Select Properties to view file information about the show or clip that is playing. The content creator can insert file properties into the ASF file when they create it, or they can set the properties in the ASX file that is used to link to their ASF. They can also set properties for an entire playlist that contains individual ASF files, each with its own properties.
Here is an example of an ASX file that inserts file properties (in the main section of the ASX) and clip properties (in individual <ENTRY> tags). In this case, the properties set are the Abstract, Title, Author, Copyright, and MoreInfo, which allows the user to click on either a banner showing on the player and have it send their browser to that URL, or allows the user to click on a MoreInfo link on the clip or file properties for more information.
<ASX version = "3.0"> <ABSTRACT>This text will show up as a Tooltip and in the Properties dialog box for the file</ABSTRACT> <TITLE>Title for this file</TITLE> <AUTHOR>The Name of the Author for this File</AUTHOR> <COPYRIGHT>1998 by Your Company</COPYRIGHT> <MoreInfo href = "http://www.microsoft.com/netshow" /> <Entry> <Ref href = "mms://netshow.microsoft.com/sbnasfs/control.asf" /> <MoreInfo href = "http://www.microsoft.com/netshow" Banner = "http://servername/path/banner1.gif" Style = "IMAGE"> <Abstract>This is the description for this clip.</Abstract> </MoreInfo> </Entry> <Entry> <Title>Markers Discussion</Title> <Copyright>1998 Microsoft Corporation</Copyright> <Logo href = "http://servername/path/banner2.gif" Style = "ICON" /> <MoreInfo href = "http://www.microsoft.com/netshow"></MoreInfo> <Ref href = "mms://netshow.microsoft.com/sbnasfs/marker.asf" /> <Ref href = "http://netshow.microsoft.com/sbnasfs/marker.asf" /> </Entry> </ASX>
The Windows Media Player and Windows Media Services together allow you to add graphics elements to the Windows Media Player as the stream plays. There are four basic types of graphics you can add:
Type | Description |
---|---|
Banner | Allows you to place a banner (82 pixels x 30 pixels) image on the player underneath the content for Windows Media Services. This image is clickable. Done using the <MoreInfo> tag. |
Icon | Allows you to place a small (16 pixels x 16 pixels) image next to the Title of the Show, or next to the Show status on the player. This graphic replaces the icon displayed on the Display panel next to the Show or Clip title (replaces graphic next to Show title when placed in the main area of the ASX, and replaces the graphic next to the clip title when placed in an <ENTRY> tag). Accomplished through the use of the <LOGO> tag. |
Image | Allows you to place a graphic (82 pixels x 30 pixels) on the player underneath the content for Windows Media Services. This graphic stays up for the duration of the show if placed in the main section of the ASX, or for the duration of the clip if placed within the <ENTRY> tag. Graphic is displayed centered horizontally, six pixels (the size of the border) above the edge of the Video area. The "IMAGE" style graphic is not displayed if a Banner graphic is defined in a MoreInfo element. Accomplished through the use of the <LOGO> tag. |
Watermark | Allows you to place a banner or graphic (82 pixels x 30 pixels) image on the player while the content is buffering. Note that the watermark does not appear on top of the content, but on the ASF before or after it plays. The MARK style is only valid if the parent element of the Logo element is ASX. The MARK style graphic is displayed in the lower right corner of the Video area (allowing for a six-pixel border) while the player is connecting to a server and opening a piece of content. Accomplished through the use of the <LOGO> tag. |
The Icon, Image, and Mark graphics are added through the <LOGO> tag in the ASX file. Here's an example for each:
<Logo href = "http://server/logos/image1.gif" Style = "ICON" /> <Logo href = "http://server/logos/image1.gif" Style = "IMAGE" /> <Logo href = "http://server/logos/image1.gif" Style = "MARK" />
If you want to make it so a viewer can click on a banner ad and then have their browser send them to a specific URL, add the <MoreInfo> tag and specify a location to get the banner from:
<ASX version = "3.0"> <!-- This is a comment. The MoreInfo tag below makes the Show title in the Display panel clickable. If the MoreInfo tag is under an Entry element, the title of the clip can be clicked on. When a user places the mouse over the title, the URL defined in the href attribute is displayed in the Status bar. When a user clicks the title, the browser starts and navigates to the page defined in the URL. When the Banner attribute is used, the user can click the graphic in the Video area to open the URL. End comment. --> <MoreInfo href = "http://www.server.com/info" Banner "http://www.server.com/logos/banner.jpg"> </MoreInfo> <Entry> <Ref href = "mms://nsserver/content/title1.asf" /> </Entry> </ASX>
You can also use Microsoft Site Server , with its Personalization and Ad Server functionality, to customize the advertisements the user receives. Simply point the URL for the advertisements to the URL of the Ad Server containing the graphics.
You can send script events down a live stream from the Windows Media Encoder that tell the ASX file to insert a specific clip into the stream. For example, at a ball game where the feed is being broadcast live over the Internet, when a team calls a time out, the person running the Windows Media Encoder could send an event down the stream called Time-Out, that when received by the client is acted upon in the ASX file:
<Event Name = "Time-Out" WhenDone = "RESUME" Refresh = "yes"> <EntryRef href = "mms://nsserver/content/advert.asf" ClientSkip = "no" /> </Event>
When the event named Time-Out is received by the client, the ASX file instructs it to insert an advertising clip called advert.asf into the stream, and when it's done playing, to rejoin the previous stream.
This can be especially powerful when you consider that you can use Active Server Pages (ASP) as links to the content. ASPs could automatically serve up ASF content that is personalized to the user's region or profile.
See "Ad Insertion" for more information.
Playlists are one of the most powerful features of Windows Media Technologies. Playlists allow you to schedule content to play in succession, or to insert advertising or special interest clips into a stream after a specific period of time or at a specific point. One of the nice parts about playlists is that instead of playing an ASF, stopping, starting the next ASF, and then waiting for it to finish buffering, Microsoft Windows Media Services and the Windows Media Player work together to play the clips one after the other with minimal buffering time or interruption in between.
The most simple playlists are created by adding multiple Entry tags to the ASX file. Within each Entry tag you can have multiple Ref tags to specify alternative locations or protocols to get the content from (protocol or server rollover). Here's an example:
<ASX version = "3.0"> <Title>Title</Title> <Entry><Ref href = "mms://nsserver/content/title1.asf" /></Entry> <Entry><Ref href = "mms://nsserver/content/title2.asf" /></Entry> <Entry><Ref href = "mms://nsserver/content/title3.asf" /></Entry> <Entry><Ref href = "mms://nsserver/content/title4.asf" /></Entry> </ASX>
If you want to set it up so that it automatically rolls over to a different server, protocol, or path if a failure occurs, just add <REF HREF> statements:
<ASX version="3"> <Entry> <ref HREF="mms://netshow.microsoft.com/sbnasfs/keister.asf"/> <ref HREF="mms://server/path/asfname.asf"/> <ref HREF="http://server2/path/asfname.asf"/> </Entry> </ASX>
In this case, it tries keister.asf on the netshow.microsoft.com server, and if that fails it tries asfname.asf on server using the mms protocol, and if that fails, it rolls over to asfname.asf on server2 using the http protocol. Keep in mind that Microsoft Windows Media Services can stream via UDP or HTTP, and even if no rollover servers are specified in the ASX, the player will automatically try protocols that are enabled on the client before it will look in the ASX for a different server to try.
Here's an example of an ASX that includes a variety of functionalities:
<ASX version = "3.0" BannerBar = "FIXED"> <ABSTRACT>This text will show up as a ToolTip for the file</ABSTRACT> <TITLE>Title for this file</TITLE> <AUTHOR>The Name of the Author for this File</AUTHOR> <COPYRIGHT>1998 by Your Company</COPYRIGHT> <Logo href = "http://servername/path/icon.jpg" style = "ICON" /> <Logo href = "http://servername/path/image.jpg" style = "IMAGE" /> <Logo href = "http://servername/path/mark.jpg" style = "MARK" /> <RefBase HREF="http://servername/path/" /> <MoreInfo href = "http://www.microsoft.com/netshow" /> <Entry ClientSkip = "no"> <Ref href = "mms://servername/path/asf1.asf" /> <Ref href = "mms://servername2/path/asf1.asf" /> <Ref href = "http://servername/path/asf1.asf" /> <Duration value = "00:00:30" /> <MoreInfo href = "http://www.microsoft.com/netshow" Banner = "http://servername/path/banner1.gif" Style = "IMAGE"> <Abstract>This is a mock Windows Media endorsement.</Abstract> </MoreInfo> </Entry> <Entry> <Title>Markers Discussion</Title> <Copyright>1998 Microsoft Corporation</Copyright> <Logo href = "http://servername/path/banner2.gif" Style = "ICON" /> <MoreInfo href = "http://www.microsoft.com/netshow"></MoreInfo> <Ref href = "mms://netshow.microsoft.com/sbnasfs/marker.asf" /> <Ref href = "http://netshow.microsoft.com/sbnasfs/marker.asf" /> </Entry> </ASX>
Here's a recap of the key tags in the ASX files, and their descriptions and syntax.
Example:
<ASX version = "3.0"> <abstract> This text will show up as a ToolTip </abstract> <Title>Hover over this title for a ToolTip.</title> </ASX>
Description: Contains text that represents a description of the associated ASX or Entry element. This text is displayed by the player in both the Display panel and the Properties dialog box. If the Abstract element is used in an ASX element, the text is displayed as a ToolTip when the mouse is placed over the title of the show in the Show bar. The title displayed in the Show bar comes from the Title element in an ASX element. The text in the Abstract element also is displayed under Description on the Show tab of the Properties dialog box. When you use the Abstract element inside an Entry element in the .asx file, the text is displayed as a ToolTip when the mouse is placed over the clip title in the Display panel, and under Description on the Clip tab of the Properties dialog box.
Example:
<asx version = "3.0" previewmode = "yes"> <EntryRef href = "http://server/content/program1.asf" /> </asx>
Description: The ASX element defines a file as an .asx file. The first four characters of an .asx file must be <asx. Other elements, such as Title and Author, defined within the scope of the ASX element (where ASX is the parent element) are associated with the Show information displayed by Windows Media Player.
Example:
<author> Author Name </author>
Description: The Author element is a text string representing the name of the author of the .asx file. You can use the Author element in the ASX and Entry elements. The text contained in the Author element is displayed in the Display panel and Properties dialog box of the player. If the Author element is used in the ASX element, the text is displayed on the Show tab of the Properties dialog box. You also can use the Author element in the Entry element, in which case the text is displayed under Clip Author in the Display area and on the Clip tab of the Properties dialog box.
Example:
<Base HREF="http://www.servername.com/" />
Description: The Base element defines a Uniform Resource Locator (URL) string appended to (the front of) URL-flip URLs sent to the client. The Base element is similar to a home directory for relative links. The Base element affects only URLs sent to the client using script commands. URL-flipping is a scripting mechanism you can use to cause the player to flip to a new URL when a script command is received.
Example:
<Copyright>Copyright 1998, CompanyName®</Copyright>
Description: The Copyright element is a text string that specifies the copyright information for an ASX or Entry element. The copyright information is displayed in the Details area of the player and the Properties dialog box. When used in the ASX element the copyright information is displayed only on the Show tab of the Properties dialog box. If you use the Copyright element in an Entry element, the text is displayed in the Clip bar of the Display area and on the Clip tab of the Properties dialog box.
Example:
<Duration value = "00:00:30" /> <Duration value = "1:01.5" /> This is the same as 61.5 seconds.
Description: The Value attribute for the Duration element defines the length of time a stream is to be rendered by the client. It is possible to set the value of the Value attribute to a length of time that exceeds the end of the content stream, in which case the stream terminates normally.
Example:
<EndMarker number = "17" /> <EndMarker name = "MarkerH" />
Description: The EndMarker element defines the named or numeric marker index where the player is to stop rendering the stream defined in the associated Entry or Ref element. An associated element is the Parent element of an element.
Example:
<ASX Version = "3.0"> <Title>The Something Catchy Station on Our Site</Title> <MoreInfo href = "http://www.server.com" />
<Entry> <Title>Catchy Tunes</title> <Abstract>Tunes you cant get out of your head</abstract> <Copyright>Copyright© 1997 Company Name®</copyright> <Ref href = "http://server/catchy.nsc" /> <Ref href = "http://backup/catchy.nsc" /> </Entry> </ASX>
Description: The Entry element is the fundamental construct in an .asx file. The Entry element and its associated attributes define to the player meta-information for a single, logical piece of content. This single piece of logical content is called a clip. Elements that are defined within an Entry element are displayed by the player in the Clip information area in the Display panel, as well as the Clip tab in the Properties dialog box.
Example:
<ASX Version = "3.0"> <Title>Title Goes Here</Title> <MoreInfo href = "http://www.server.com" /> <Entry> <Title>Title of This Clip</title> <Abstract>More Info About This Clip Goes Here</abstract> <Copyright>Copyright 1998 Company Name</copyright> <EntryRef href = "http://servername/path/asxname.asx" ClientBind = "no" /> </Entry> </ASX>
Description: The EntryRef element is used when the content of an Entry is defined in an external .asx file. Using the EntryRef element is similar to including the textual contents of the referenced .asx file into the current position of the current .asx file.
Example:
<!-- This is a comment section. The section below defines two dynamic advertisements with dynamic "meta" data, one regional and one local. When the playing of the ads is complete the featured content resumes. End comment section --> <Event Name = "Regional-Ad" WhenDone = "RESUME" Refresh = "yes"> <EntryRef href = "regional.asp" ClientSkip = "no" /> </Event> <Event Name = "Local-Ad" WhenDone = "RESUME" Refresh = "yes"> <EntryRef href = "local.asp" ClientSkip = "no" /> </Event>
Description: An event is a script command embedded in a stream sent to the client that consists of a double-string. The first string is the word event (this is case-sensitive), and the second string is the event name. The event name in the second string must match the event name defined in the .asx file. The two are case-sensitive to each other. Events can be sent to a client receiving a real-time stream, or can be saved in an .asf file that gets delivered as an on-demand unicast stream. When the script command is received, the client processes the Event. The Event element defines a scope of Entry and/or EntryRef elements that play whenever the script command including the named event is received by the player. This allows the author to specify a behavior for stream switching in near real time, as opposed to pre-authored stream changes using references to other pieces of content or .asx files. The preceding example demonstrates using the Event element in an .asx file to deliver advertisements to the client without disconnecting the user from the content being viewed. The author also can define what action the client takes after playing the stream defined in the Event element.
Example:
<Logo href = "http://server/logos/image1.gif" Style = "ICON" /> <Logo href = "http://server/logos/image1.gif" Style = "IMAGE" /> <Logo href = "http://server/logos/image1.gif" Style = "MARK" />
Description: The Logo element specifies the URL for a graphic file that is associated with an ASX or Entry element (a show or clip). These graphic files are displayed in the player as they are defined by the Logo element attributes. Logo elements defined within an ASX element (where the ASX element is the parent element) are displayed for the duration of a play list. All graphic styles except ICON are displayed in the View area of the player. The ICON style images are displayed next to the title of the clip, or shown in the Display panel, depending on the parent of the Logo element. If no ICON style Logo elements are included in the ASX, the graphic displayed next to the title is the icon associated with the file name type. Logo formats follow the Microsoft® Internet Explorer Channel guidelines as follows, with all sizes in pixels: ICON - 16 height x 16 width; IMAGE - 32 height x 80 width; MARK - 32 height x 80 width; Windows Media Player supports GIF, BMP, and JPG graphic formats.
Example:
<!-- This is a comment. The MoreInfo tag below makes the Show title in the Display panel clickable. If the MoreInfo tag is under an Entry element, the title of the clip can be clicked on. When a user places the mouse over the title, the URL defined in the href attribute is displayed in the Status bar. When a user clicks the title, the browser starts and navigates to the page defined in the URL. When the Banner attribute is used, the user can click the graphic in the Video area to open the URL. End comment. --> <MoreInfo href = "http://www.server.com/info" Banner "http://www.server.com/logos/banner.jpg"> </MoreInfo> <Entry> <Ref href = "mms://nsserver/content/title1.asf" /> </Entry> </ASX>
Description: The MoreInfo element allows the content creator to provide a URL to a Web site that contains further details about the content the user is viewing (or any other Web site). The URL defined in the href attribute is displayed as a ToolTip when the mouse cursor is placed over the Banner graphic, if one is included. If there is an Abstract element within the scope of the MoreInfo element, the Abstract text is displayed as the ToolTip. When a user clicks on the Banner image, the browser starts and connects to the URL. If there is no Banner attribute in the Logo element, the user accesses the URL from the File menu. On the File menu, there is a More Information submenu that is only available if the open .asx file contains a MoreInfo element. On the More Information submenu, there are three items: Show, Clip, and Banner. If the parent element of the MoreInfo element is an ASX, the Show item is available. When a user clicks Show on the submenu, the browser starts, and opens the page referenced in the href attribute. If the parent element is an Entry, the Clip item is available. If the MoreInfo element contains a Banner attribute, the Banner item in the More Information submenu is available. Clicking Banner has the same effect as clicking the Banner graphic in the Video area.
Example:
<ASX version = "3.0"> <Title>Most requested titles of the day</Title> <Entry><Ref href = "mms://nsserver/content/title1.asf" /></Entry> <Entry><Ref href = "mms://nsserver/content/title2.asf" /></Entry> <Entry><Ref href = "mms://nsserver/content/title3.asf" /></Entry> <Entry><Ref href = "mms://nsserver/content/title4.asf" /></Entry> <ASX>
Description: A playlist consists of multiple Entry elements in an .asx file. Each Entry element in the .asx file is played by the client in the order they appear in the .asx file as though the user had manually opened each clip.
Example:
<Entry> <Ref href = "mms://nsserver/content/selection.asf"> <PreviewDuration value = "0:30.0" /> </Ref> </Entry>
Description: The PreviewDuration element defines the length of time the clip defined in the associated Entry or Ref element is played in Preview Mode. An associated element is the element parent element.
Example:
<!-- This is a comment. There are multiple Ref elements below. Only one clip (or station if using .nsc files) will be connected to and played. If the URL in the first Ref element fails, the second Ref URL is tried. If it also fails, the third Ref URL is tried. If all three fail, the next Entry or EntryRef element in the ASX, if any, is processed. End comment. --> <Entry> <Ref href = "mms://nsserver/pubpt/selection1.asf" /> <Ref href = "mms://nsserver2/pubpt/selection1.asf" /> <Ref href = "mms://nsbackup/pubpt/selection1.asf" /> </Entry>
Description: The Ref element specifies a Uniform Resource Locator (URL) for a content stream. The URL can point to either an Advanced Streaming Format (ASF or .asf) file for on-demand content, or an .nsc file that provides the player with information about a Windows Media station. A Windows Media station is a real-time stream. The Ref element can appear only as a child element of an Entry element.
Example:
<RefBase href = "http://www.server.com/ads/" />
Description: The Uniform Resource Locator (URL) defined in the href attribute of the RefBase element is appended to (in front of) the value of the href attribute of both EntryRef and Event elements. The purpose of the RefBase element is to allow the ASX author to use relative links to content rather than specifying the entire path. Href attributes in other elements that contain a protocol (mms:// or http://) are not affected by the RefBase element.
Example:
<Repeat Count = "2"> <Entry><Ref href = "mms://nsserver/clips/clip2.asf" /></Entry> <Entry><Ref href = "mms://nsserver/clips/clip3.asf" /></Entry> </Repeat>
Description: The Repeat element is used to define the number of times the client repeats the play of an Entry element or set of Entry elements.
Example:
<StartMarker Number = "5" /> <StartMarker Name = "MarkerC" />
Description: The StartMarker element identifies the named or numbered index marker where the Windows Media Player is to start playing the stream referenced in the associated Entry or Ref element. When the content referenced is opened, it begins playing at the defined marker rather than the beginning of the clip. Markers are present only in stored content.
Example:
<Entry> <!-- This is a comment. The StartTime element below causes the client to begin playing the clip one minute and 30 seconds after the beginning. End comment. --> <StartTime Value = "1:30.0" /> <Ref href = "mms://nsserver/content/title1.asf" /> </Entry>
Description: The StartTime element defines a time index into the content where the client is to start playing the stream. The StartTime element can be used only with stored, on-demand content that has been indexed.
Example:
<ASX version = "3.0"> <Title>Title of the Show</title> <Author>Person who wrote this ASX</author> <Entry> <Title>Title of the Clip</Title> <Ref href = "mms://nsserver/content/title1.asf" /> </Entry> </ASX>
Description: The Title element defines a text string displayed by Windows Media Player as the Show or Clip title, depending on the parent element of the Title element. If the parent element is ASX, the text is displayed as the Show title in the Display panel, as well as on the Show tab of the Properties dialog box. If the parent element is Entry, the text is displayed as the Clip title in the Display panel and on the Clip tab of the Properties dialog box. If a MoreInfo element is also used with the associated (parent) element, it is the Title text that the user clicks on to start a browser and navigate to the URL defined in the MoreInfo element.
There are two types of ASX files: handcrafted as discussed earlier, and machine-generated. The machine-generated files are encrypted and they will allow you to publish an announcement that will support multicast. They are generated in Windows Media Technologies tools.