Goal: To use the URL event in an ASF file to flip URLs into another frame for both Microsoft Internet Explorer and Netscape Navigator . ASF has the ability to send script command events to the browser. The most common of these is the URL event. A URL event will "flip" URLs into a frame, allowing HTML pages to be synchronized with a streaming audio or video file.

More Details URL script command types are launched by the default Web browser when they are received by the player control. If the control is embedded in an HTML page that employs frames, the URL can be launched in a frame specified by the script command. This allows the control to continue rendering the multimedia stream in one frame while the Web browser renders images or Web pages in another frame.

Code to Include First we'll start with a simple , because we'll need one frame to write our content into and another frame to host the Media Player.

<frameset cols="*,190"> <frame src="/article/windows-development/frame0.htm" name="leftFrame"> <frame src="/article/windows-development/media.htm" name="rightFrame"> </frameset> This simply defines a set of two pages. "Frame0.htm" is the first slide in our presentation. "Media.htm" is where the code will reside that embeds the Media Player.

This file also uses our generic cross-browser code embedding code. This code will instantiate the Media Player ActiveX control for browsers which support ActiveX, and the Media Player plug-in for browsers that don't: <object id="MediaPlayer1" width="160" height="182" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <param name="FileName" value="http://webserver/path/your-file.asx"> <param name="ShowStatusBar" value="True"> <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="http://webserver/path/your-file.asx" name="MediaPlayer1" width="160" height="182" showstatusbar="true"></embed></object> Since the URL event is handled instrinsically by the player, we won't need any JavaScript for this sample. We will, however, need to embed the script commands inside the ASF file. We can do this using the ASF Indexer tool (a part of the Windows Media tools package).

First, open up the ASF Indexer -- the default location of this tool is Start -> Programs -> Windows Media -> ASF Indexer. Once it is running, select File -> Open. This will bring up a dialog box which will allow you to specify a piece of ASF content. Click the "Edit Script Commands" button. This will bring up the "Script Commands" dialog box. Click "New." Choose a time for you script command (in hours:minutes:seconds.tenths format) and leave the "type" of script command as "URL."

The parameter field is where you reference your HTML (or image) file in the following format: your-file.extensionandandFrame-name, where your-file.extension is the name of your file. Frame-name will allow you to specify a name for your frame. In our example, we'll be using leftFrame (capitalization counts). When you're done, click "OK."

Your ASF Indexer should look something like this:

Repeat this process for all of your URL events, click "OK," and then File -> Save. Now you have created script commands in your ASF file.

Browser/Platform Compatibility This code will work with Internet Explorer 4+, and Netscape Navigator 4+ on platforms that support the Windows Media Player plug-in and ActiveX control.

Complete Article

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish