Click Here to Install Silverlight*
United StatesChange|All Microsoft Sites
Windows Media Player 9 Series
|Windows Media Worldwide

Introduction to Windows Media Metafiles

Abstract
Summary: Windows Media metafiles provide metadata and playback instructions for digital media files. There are two types of metafiles: client-side and server-side. Client-side metafiles provide instructions for Windows Media® Player, while server-side metafiles provide instructions for a Windows Media server. This article describes how to use client-side metafiles with Windows Media Player 9 Series or later.

 

David Wrede
Microsoft Corporation
Updated December 2004
 
Applies to:
Microsoft® Windows Media® Player 9 Series
Microsoft Windows Media Player 10
 

Introduction

Windows Media metafiles, commonly known as playlists, are text files that link Web pages to Windows Media–based content on a Windows Media server or Web server. The purpose of a metafile is to redirect streaming media content away from browsers, which in most cases are not capable of rendering the content, to Microsoft® Windows Media Player. Windows Media metafiles have a .wvx, .wax, or .asx extension. When a browser downloads a file with one of these extensions from a Web site, the browser opens Windows Media Player. Windows Media Player then locates and plays the content specified in the file.

A Windows Media metafile contains a type of Extensible Markup Language (XML) scripting that can be interpreted only by Windows Media Player. A metafile script can be as simple or complex as you need it to be. The most basic metafile contains simply the Uniform Resource Locator (URL) of some digital media content on a server. A complex metafile can contain references to multiple files or streams arranged in a playlist, instructions on how to play the files or streams, text and graphic elements, and hyperlinks associated with elements on the Windows Media Player user interface.

At the end of this article you will find the code for an example metafile that demonstrates the features described in the rest of the article.

This article covers the following topics:
Back to the top of this pageBack to Top


Creating a Simple Metafile

To get started creating a simple metafile, open your favorite text editor, such as Microsoft Notepad, and type the following items:

<ASX version="3.0">
<ENTRY>
<REF HREF="Path"/>
</ENTRY>
</ASX>
In the third line, replace Path with the path or URL of your Windows Media–based content using a syntax from the following table.

Source of contentSyntax
File on a Windows Media server
rtsp://ServerName/Path/FileName.wmv
Multicast stream that is accessed from a Windows Media server
http://WebServerName/Stations/kxyz.nsc
Unicast stream that is accessed from a publishing point on a Windows Media server
mms://ServerName/PublishingPointAlias
File on a Web server
http://WebServerName/Path/Filename.wmv
File on a network share
file://\\ServerName\Path\Filename.wmv
File on a local hard disk
file://c:\Path\Filename.wmv

After you type this into Notepad, save the file as Filename.wvx if it is used to redirect video files that have a .wmv extension. Save the file with a .wax extension if it redirects audio-only files that have a .wma extension. Typically, Filename is the name of the Windows Media file or stream, but it can be any name you choose. Check to be sure that the metafile is working by double-clicking its file name in Windows® Explorer. Windows Media Player should open and start streaming the content.

After you've confirmed that the metafile works, save it to your Web server along with your Web pages, and link to it by means of an <a href> tag, or embed it in a Web page using the <OBJECT> tag.

Back to the top of this pageBack to Top


File or Clip Properties

When creating content, you can insert file properties, such as title, author, and copyright, directly into a Windows Media file, or you can insert the properties in the Windows Media metafile that is used to link to the content. Any properties that you enter in the metafile override those contained in the Windows Media file. You can also set properties for an entire playlist that contains multiple Windows Media streams. When you play the content, some properties are displayed on the Windows Media Player user interface, and others on the Windows Media Player Properties sheet.

Here is an example of a playlist metafile that contains global playlist properties as well as properties for individual clips that are contained inside ENTRY elements. In this case, the properties are set using ABSTRACT, AUTHOR, BANNER, COPYRIGHT, MOREINFO, and TITLE elements.

<ASX version = "3.0">
<ABSTRACT>This text will show up as a Tooltip and in the Properties
dialog box.</ABSTRACT>
<TITLE>Global title of the show</TITLE>
<AUTHOR>The name of the author</AUTHOR>
<COPYRIGHT>2004 by Your Company</COPYRIGHT>
<MOREINFO HREF = "http://www.microsoft.com/windows/windowsmedia" />
<ENTRY>
<REF HREF = "rtsp://ServerName/Path/FileName.wmv " />
<BANNER HREF="http://Servername/Path/Banner1.gif">
<MOREINFO HREF ="http://www.microsoft.com/windows/windowsmedia" />
<ABSTRACT>This is the description for this clip.</ABSTRACT>
</BANNER>
</ENTRY>
<ENTRY>
<TITLE>Markers Discussion</TITLE>
<COPYRIGHT>2004 Microsoft Corporation</COPYRIGHT>
<MOREINFO HREF = "http://www.microsoft.com/windows/windowsmedia"></MOREINFO>
<REF HREF = "rtsp://ServerName/Path/markers_info.wmv" />
</ENTRY>
</ASX>
The MOREINFO element adds functionality beyond simple text. In this example, MOREINFO elements add hyperlinks to the clip and show text on Windows Media Player. End users can click the text to link their browsers to Web sites that, for example, provide more information about an advertisement or music video.

With Windows Media metafile scripting, you can add BANNER elements to Windows Media Player as the stream plays. With this element you can place a banner (194 pixels wide x 32 pixels high) image on the Player at the bottom of the Video and Visualization pane. You can then add a hyperlink to the banner with a MOREINFO child element.

In the example playlist, the BANNER element in the first ENTRY element of the playlist displays an image in the banner bar of Windows Media Player just below the video display. The BANNER element also contains MOREINFO and ABSTRACT child elements that add a hyperlink and abstract text to the banner.

Back to the top of this pageBack to Top


Ad Insertion

You can send script commands in a stream that instruct Windows Media Player to cut away from the stream and play other streams or files according to scripting in a metafile. This scripting technique can be used for inserting advertisements in a stream. For example, during a live Internet broadcast of a ball game, a script command can be sent at the beginning of every commercial break, instructing each client (Windows Media Player) to play commercials listed in its metafile. When clients finish playing the commercials, scripting in the metafile instructs each client to cut back to the live broadcast. To take it a step further, Active Server Pages (ASP pages) and server-side scripting can be used to create metafiles on-the-fly for each client. So conceivably, by using metafile scripting, ad insertion could be personalized for each end user connecting to the ball game.

Ad insertion is implemented using the EVENT element. The following example inserts the ad Advert.asf into the broadcast unicast stream BallGame when a client receives a script command with the Event type and the Time-Out parameter. When the ad is finished, the client resumes playing the previous entry.

<ASX VERSION="3.0">
<ENTRY>
<REF HREF="http://sample.microsoft.com/BallGame" />
</ENTRY>
<EVENT NAME="TimeOut" WHENDONE="RESUME">
<ENTRY CLIENTSKIP="NO">
<REF HREF="http://Server/Content/Advert.asf" />
</ENTRY>
</EVENT>
</ASX>

Back to the top of this pageBack to Top


Playlists

Playlists are powerful and flexible. With playlists, you can schedule content to play in succession, or you can insert advertising or special-interest clips into a presentation after a specific period of time or at a specific point. Windows Media Services and Windows Media Player work together to play the clips in a playlist with minimal buffering time or interruption between clips.

The simplest playlists are created by adding multiple ENTRY elements to a metafile. Here's an example of a simple playlist:

<ASX VERSION = "3.0">
<TITLE>Title</TITLE>
<ENTRY>
<REF HREF = "rtsp://ServerName/Path/title1.wmv" />
</ENTRY>
<ENTRY>
<REF HREF = "rtsp://ServerName/Path/title2.wmv" />
</ENTRY>
<ENTRY>
<REF HREF = "rtsp://ServerName/Path/title3.wmv" />
</ENTRY>
<ENTRY>
<REF HREF = "rtsp://ServerName/Path/title4.wmv" />
</ENTRY>
</ASX>

Back to the top of this pageBack to Top


Server or Protocol Rollover

You can use metafiles to provide a means of automatically switching to alternate content sources when a stream cannot be accessed or played for some reason. This is called rollover, and you can use it to specify alternate content on different servers or even different types of servers. You can, for example, specify a first alternate on a different Windows Media server. If that content fails to play, the client can rollover to a second alternate on a Web server:

<ASX version="3.0">
<ENTRY>
<REF HREF="rtsp://Server1/Path/File1.asf"/>
<REF HREF="mms://Server2/Path/File1.asf"/>
<REF HREF="http://WebServer/Path/File1.asf"/>
</ENTRY>
</ASX>
Windows Media Services 9 Series can use RTSP, HTTP, or MMS for streaming. It uses RTSP when trying to connect to Windows Media Player 9 Series or later. If that attempt is unsuccessful, the server uses HTTP to connect to the Player. Earlier versions of the Player do not support RTSP, but they do support MMS. If the server cannot connect to the Player by using MMS or RTSP, then the server tries to connect using HTTP. Windows Media Player automatically tries to rollover to different protocols according to its Windows Media property settings before trying the rollover URLs in the metafile.

Back to the top of this pageBack to Top


Putting It All Together

Here's an example of a metafile that includes a variety of functionalities:
  • File and clip properties set through the ABSTRACT, AUTHOR, COPYRIGHT, MOREINFO, and TITLE elements.
  • Relative paths to URLs received through script commands set using the BASE element.
  • Hyperlink from a banner ad to a Web page using the MOREINFO and BANNER elements.
  • BANNER element used to add custom graphics in Windows Media Player.
  • Playlist created by inserting multiple ENTRY elements in succession. The first Windows Media file plays for only 30 seconds, as specified in the DURATION element.
  • Server and protocol rollover set by placing multiple REF elements in succession within one ENTRY element.
  • Clip configured, by setting CLIENTSKIP ="no" in the ENTRY element, so that the end user cannot fast-forward through it.

<ASX VERSION = "3.0" BANNERBAR = "FIXED">
<ABSTRACT>This text will show up as a ToolTip for the show.</ABSTRACT>
<TITLE>Show Title</TITLE>
<AUTHOR>Show Author</AUTHOR>
<COPYRIGHT>2004 by Your Company</COPYRIGHT>
<BASE HREF= "http://samples.microsoft.com/" />
<MOREINFO HREF = "http://www.microsoft.com/windows/windowsmedia" />
<ENTRY CLIENTSKIP = "no">
<REF HREF = "rtsp://Server1/path/File1.asf" />
<REF HREF = "rtsp://Server2/path/File1.asf" />
<REF HREF = "http://Server3/path/File1.asf" />
<DURATION VALUE = "00:00:30" />
<BANNER HREF="http://AdServer/Path/Banner1.gif">
<MOREINFO HREF = "http://www.microsoft.com/windows/windowsmedia" />
<ABSTRACT>This is a tooltip for clip 1.</ABSTRACT>
</BANNER>
</ENTRY>
<ENTRY>
<TITLE>Markers Discussion</TITLE>
<COPYRIGHT>2004 by Your Corporation</COPYRIGHT>
<MOREINFO HREF = "http://www.microsoft.com/windows/windowsmedia"></MOREINFO>
<REF HREF = "rtsp://Server1/Pubpoint/marker.asf" />
<REF HREF = "mms://Server1/Pubpoint/marker.asf" />
</ENTRY>
</ASX>

Back to the top of this pageBack to Top


For More Information

To learn more about metafiles, see the Windows Media metafile reference section on the MSDN Web site or download the Windows Media Player 10 Software Development Kit (SDK) from the Microsoft Windows Media Developer Center. That SDK contains the metafile reference.

Legal Notice

This software is based in part on the work of the Independent JPEG Group.

GIF decompression code, copyright 1990, David Koblas. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.

Back to the top of this pageBack to Top



© 2016 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy & Cookies
Microsoft