Windows Media : Simple ASX

Description: Goal- Create a simple ASX file to play Windows Media in the external Windows Media Player. A simple, yet effective method of playing Windows Media, is to simply reference an ASF Stream Re

ITPro Today

February 18, 2002

3 Min Read
ITPro Today logo

Description: Goal- Create a simple ASX file to play Windows Media in the external Windows Media Player. A simple, yet effective method of playing Windows Media, is to simply reference an ASF Stream Redirector file (ASX). An ASX file is an eXtensible Markup Language (XML) based text file which references a Uniform Resource Locator (URL) for a piece of media content. Simply put, an ASX file is a shortcut to Media Content. The following are the hexadecimal number for the specified permissions. The access mask (sum of hex numbers for permissions used), is used in the security descriptor.

More Details

An ASX file should always be used to reference media content for the standalone player for two main reasons:

Browsers other than Microsoft Internet Explorer do not intrinsically understand the Microsoft Media Server (MMS) streaming protocol. As such, they cannot locate or obtain information about the Media File. Without an ASX file, content cannot stream to the media player. When you click on a link in a browser, that file is downloaded to the browser's cache. When, however, you click on a reference to an ASX, the ASX (which is a very small download) gets downloaded into the cache, and then launches the helper application associated with the ASX MIME type (application/mplayer2 or video/x-ms-asf), which is the Windows Media Player. This, of course, saves download time and takes advantage of intelligent media serving technology.

Code to Include
To reference an ASX file, simply add the following code to your Web page:


Link to Streaming Content
The browser will open this file and then launch the Windows Media Player to play this content. 


Here is the Basic syntax for an ASX file: 





Microsoft Corporation
(c)1999 Microsoft Corporation




Here's what each line does: Line Description 
  Identifier for the client (Windows Media Player) that this is an ASX file. The attribute shown here is "version" which is a required attribute specifying the version of the ASX. This element is required. 
  Identifies the title of the ASX file as a whole. This information is displayed in the "Show" label of the Media Player.
 Begins the block entry element. An  element is a way to define a particular clip in an ASX.
  Identifies the title of the clip within the ASX. It is different than the previous  pair because this one is nested within an  block element. This information is displayed in the "Clip" label of the Media Player. 
Microsoft Corporation  Identifies the author of the media clip, similarly to the  pair. This information is displayed in the "Author" label of the Media Player.
(c)1999 Microsoft Corporation  Identifies the author of the media clip, similarly to the  pair. This information is displayed in the "Copyright" label of the Media Player. 
  Simple comment, in the same format as HTML comments.    Actual pointer to the media content. The REF attribute identifies the line as a pointer to content, while the HREF attribute is the URL to the file. In this case, the URL uses the MMS protocol, so it points to a NetShow Services media server. 
Remember that ASF files on your media server are not usually kept in the same location as your HTML documents.

Note: the use of the XML-like closing of the tag. Since this element does not have child elements (data within the tag which is not contained in an attribute), it closes itself. 

  Specifies the end of the of the  element.  
  Specifies the end of the ASX.  



Browser/Platform Compatibility

Since ASXs work through a helper application, they are compatible with any browser that supports helper applications. This sample will work with Internet Explorer 4.0 and greater, and Netscape Navigator 4.0 and greater on the Win32 and Mac platforms.

Complete Article

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like