Contents Index Topic Contents | |
Previous Topic: Using ASX Metafiles Next Topic: Working with ASX Files |
Creating ASX Files
An Advanced Stream Redirector (ASX) file is a plain-text file which uses Extensible Markup Language (XML) tags to identify the media and information associated with each clip. This text file must have a file name extension of .asx to be recognized by Microsoft® Windows® as an ASX file. You can create an ASX files using any text editor, such as Microsoft® Notepad or Microsoft® Word.
Important: An ASX file must not include any formatting codes from a word processor, such as Microsoft Word. To make sure no formatting codes are included in the ASX file, save the file as a plain text or ASCII file.
This article contains the following sections.
Creating a Basic ASX File
Each ASX file starts with a tag of the form <ASX VERSION="3.0">, and ends with a closing tag of the form </ASX>. Within the opening and closing ASX tags are ENTRY tags that define information about the media files used for this ASX file. Each ENTRY tag should contain a REF tag, which specifies the path to the media file for playback, but can also contain additional information about the media title and author.
The following text example shows a basic ASX file.
<ASX VERSION="3.0"> <TITLE>Example Media Player Show</TITLE> <AUTHOR>Windows Media Technologies</AUTHOR> <COPYRIGHT>(c) 1999, Microsoft Corporation</COPYRIGHT> <ENTRY> <TITLE>Example Clip</TITLE> <AUTHOR>Windows Media Technologies</AUTHOR> <COPYRIGHT>(c) 1999, Microsoft Corporation</COPYRIGHT> <REF HREF="http://samples.microsoft.com/media.asf" /> </ENTRY> <ENTRY> <TITLE>Another Clip</TITLE> <AUTHOR>Windows Media Technologies</AUTHOR> <COPYRIGHT>(c) 1999, Microsoft Corporation</COPYRIGHT> <REF HREF="http://samples.microsoft.com/more_media.asf" /> </ENTRY> </ASX>To create your own ASX file, you can simply copy and paste this example into a text file. Be sure to change the URLs and title, author, and copyright information to so they are correct for your local media files. Save the file with an .asx extension added to its name, and then open the file in Windows by double clicking on its icon. This will open the Windows Media Player application, which will play the media files in the specified order.
Note in this example that each ENTRY element has a child REF element and therefore must have a closing tag in the form </ENTRY>. The REF elements do not contain any child elements, so a single slash ("/") can be used at the end of the tag, in place of a closing </REF> tag.
Also note that the ASX element itself can also contain the TITLE, AUTHOR, and COPYRIGHT child tags. This information defines a show, and each of the ENTRY tags defines a clip. The entire collection of information is often called a playlist, because the Windows Media Player plays the media files in the order listed in this ASX file.
While a media file is playing, Web page scripts can use the GetMediaInfoString method to retrieve information specified in the ASX file. This method can access the AUTHOR, COPYRIGHT, TITLE, and other information for the current clip or show.
Creating an ASX File with Custom Parameters
An ASX file can also store clip information in PARAM tags for each media file entry. The information contained in these tags is determined entirely by the creator of the ASX file, and can be used with custom web scripts for any purpose, for example, to display other information and links related to a clip elsewhere on the page. Web scripts can use the GetMediaParameter method to retrieve information defined in a PARAM element.
The sample ASX file below shows the use of PARAM tags within ASX entries.
<ASX VERSION="3.0"> <TITLE>Example Media Player Show</TITLE> <PARAM NAME="Director" VALUE="Jane D." /> <ENTRY> <TITLE>Example Clip</TITLE> <REF HREF="http://samples.microsoft.com/media.asf" /> <PARAM NAME="Title" VALUE="Example Clip" /> <PARAM NAME="Location" VALUE="North America" /> <PARAM NAME="Release Date" VALUE="March 1998" /> </ENTRY> <ENTRY> <TITLE>Another Clip</TITLE> <REF HREF="http://samples.microsoft.com/more_media.asf" /> <PARAM NAME="Title" VALUE="Another Clip" /> <PARAM NAME="Location" VALUE="Japan" /> <PARAM NAME="Release Date" VALUE="December 1996" /> </ENTRY> </ASX>Note that the title information for each entry is repeated inside a PARAM tag. This makes the title information available to both the GetMediaInfoString method and the GetMediaParameter method.
Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.