About the ASX Metafile Sample
The ASX Metafile Sample includes two .asx files that demonstrate some of the basic features of ASX scripting.
File name |
Description |
Demo1.asx |
Plays one .asf file, and populates the Windows Media Player display with show and clip titles, and author and copyright text. Abstract text is displayed when you move the mouse pointer over an area of the display. MoreInfo URLs initiate links when you click certain areas of the display. |
Demo2.asx |
Demonstrates all the features and functionality shown in Demo1.asx, and plays four entries back to back in a playlist: an ad, a show clip twice, and the ad again. Properties on the display change with each clip, and the StartTime tag is used to start the third entry 5 seconds in from the beginning of the file. |
Open the two .asx files in a text editor to see how they are built. The .asx files contain comments to help you understand how the scripting is used. For more information on syntax and the scripting elements available, see Using ASX files and the ASX Elements Reference in the Windows Media Player Control SDK. The Task Wizard Sample in the Windows Media Technologies SDK is a tool you can use to simplify building .asx files.
Expanding on this Sample
ASX scripting is a powerful tool you can use to control presentation of ASF media.
- Insert advertising. ASX scripting was created to help businesses market products and services by using ad insertion. As demonstrated in this sample, playlists in an .asx file can contain both commercial and program entries. But the .asx files in this sample have been hard-coded. Using many of the Web, server, and database tools available today, you can create .asx files that are personalized for each user who visits your site. For example, specialized ad servers can be used in conjunction with Active Server Pages (ASP) to create playlists on the fly that contain ads targeted at individual users. The same methods can be used in corporate communications, online training, and media design. For more information, see ASX Scripting Overview, and Personalized Media Delivery.
- Configure Windows Media Player. Use ASX scripting to enhance presentation of your media, and use the Windows Media Player Control SDK to help integrate Windows Media Player into your particular Web design. In this ASX Metafile Sample, Windows Media Player is in the stand-alone configuration. But by using the ActiveX control and Netscape plug-in, you can embed Windows Media Player in a Web page. Then by using its properties and methods, you can control how it appears and plays back media. For example, you can choose to make only certain sections of the Windows Media Player interface visible, or you can hide the entire interface and create your own Windows Media Player user interface. The Online Training Sample uses an embedded Windows Media Player.
- Balance server load. If your HTTP server is capable of serving ASP pages, you can create .asx files on the fly. A simple way to balance the load on your Windows Media servers is to create .asx files that point clients to different servers in a round-robin fashion. For example, assuming you have three servers online, client 1 can receive an .asx file that points it to mms://Server1/Livefeed. Client 2 can receive an .asx file that points it to mms://Server2/Livefeed. The third client can receive an .asx file that points it to mms://server3/livefeed. When the fourth client connects, an .asx file is created that points the client back to the first server, mms://server1/livefeed. Using this simple method, each Windows Media server receives the same number of clients, and the load is balanced. For more information, see the ASX Scripting Overview.
- Preview pay content. Streaming media offers a simple means of distributing music and other audio to millions of users on the Internet. With Windows Media Rights Manager, you as producer have a method of ensuring that piracy of copyrighted material is minimized. An .asf file that has been encrypted using Windows Media Rights Manager can be downloaded and copied, but it cannot be played without a corresponding key. If you use Windows Media Rights Manager for your copyrighted music, or are planning a pay-per-view event, you can offer users a preview of the material by using ASX scripting.
If you have a site that sells music, for example, create an ASP page so that users can build preview playlists. The ASX scripting can add banner ads with MoreInfo URLs to each entry in the playlist. While listening to a 30-second preview of a CD cut, a user can click the ad banner. The link in the ad banner moves the browser to a Web page where the full CD can be purchased and downloaded. The user previews a 30-second unencrypted low bit rate .asf file, but purchases a CD-quality audio file that has been encrypted. When the purchase is made, the user receives a key that allows the file to be played. For more information, see the Windows Media Rights Manager SDK.
For more information about ASP pages, see Using ASP Pages to Dynamically Create ASX Files in the Windows Media Player Control SDK.
See Also
Using the ASX Metafile Sample, Windows Media Technologies Solutions Samples
© 1996-1999 Microsoft Corporation. All rights reserved.