Windows Media Player 11 SDK Creating an HTMLView Presentation
To create a basic HTMLView presentation, you need at least three elements:
- Digital media content. This is one or more audio or video files that Windows Media Player plays.
- A Web page. This is the Web-based content that displays in the Now Playing feature of the Player UI.
- A Windows Media metafile. This is the metafile playlist that directs Windows Media Player to combine the digital media content with the Web page.
An .asx file is a text file that provides information about a file stream and its presentation. Based on Extensible Markup Language (XML) syntax, .asx files can contain a variety of elements, each identified by a tag with associated attributes. The PARAM element provides a way to associate a custom parameter with either a particular entry in a metafile playlist or the entire metafile. One of the predefined parameter names available for your use is "HTMLView". This is the parameter that causes the Web page specified by the URL value to be displayed in Windows Media Player.
The following example code shows an .asx file that combines a single digital media file with a single Web page:
<ASX version="3.0"> <PARAM name="HTMLView" value="http://www.proseware.com/htmlview.htm"/> <ENTRY> <REF href="rtsp://www.proseware.com/content1.wma"/> </ENTRY> </ASX>
When Windows Media Player opens the .asx file in the preceding example, it plays the audio from the file named content1.wma and opens the Web page named htmlview.htm in the Now Playing feature of the full-mode Player. The user can pause, seek, and stop the audio content using the Windows Media Player controls.
You can easily change the Web page that is displayed for each piece of content by associating a PARAM element with each entry, as the following code example shows:
<ASX version="3.0"> <ENTRY> <PARAM name="HTMLView" value="http://www.proseware.com/htmlview1.htm"/> <REF href="rtsp://www.proseware.com/content1.wma"/> </ENTRY> <ENTRY> <PARAM name="HTMLView" value="http://www.proseware.com/htmlview2.htm"/> <REF href="rtsp://www.proseware.com/content2.wma"/> </ENTRY> </ASX>
In the preceding example, Windows Media Player first displays the Web page htmlview1.htm while playing the digital audio file content1.wma. When the Player opens the next entry in the playlist, content2.wma, the Web page displayed in Now Playing changes to htmlview2.htm. In this way, you can specify which Web page the user sees for each piece of digital media content.