|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
One compelling feature of Advanced Streaming Format (ASF) streams is that they can deliver script commands to the Microsoft Windows Media Player (WMP) control, along with the audio and video streams. These script commands are pairs of Unicode strings synchronized with a particular time in the multimedia stream. The first string identifies the type of command being sent, and the second specifies the command to process. When the stream reaches the time associated with a command, the control sends a ScriptCommandevent to the web page which contains it. An event-handling routine can then respond to this event. The script command strings are passed to the event handler as parameters of the ScriptCommand event.
The WMP control automatically processes the following types of embedded script commands. Event-handling routines are not necessary to process these types of commands.
When the WMP control receives a URL-type command, it has two tasks. The control must first interpret the URL to determine what must be opened, and then it must determine where to display that content.
The URL is interpreted in the following manner. If the URL is an absolute address (i.e. http://server.com/content.html) it is launched unmodified. If it is a relative path, the control determines the base prefix according to the following rules:
The resulting URL is passed as the command parameter of the ScriptCommand event.
After the location of the content has been determined, the control must determine where to display the content. If the WMP control is embedded in an HTML file that uses frames, the URL can be launched in a frame specified by the script command. This allows the WMP control to continue rendering the multimedia stream in one frame, while the browser renders images or Web pages in another frame. If the script command does not specify a frame, the DefaultFrameproperty determines the frame in which the new URL is launched.
Note If the HTML file does not use frames, or if the URL-type command is launched in the same frame as the WMP control, the URL-type command will be ignored unless the following registry key is set. This allows the WMP control to open another instance of the browser. This key is off by default.
You can enable or disable automatic processing of URL-type script commands by setting the InvokeURLsproperty. If this property is false, the WMP control ignores URL-type commands. The ScriptCommandevent is still sent to the container, however, allowing for conditional processing of URL-type commands.
When the WMP control receives a FILENAME-type command, it sets the FileNameproperty to the value specified by the command. The WMP control then opens the file and begins rendering the stream from the new location. The WMP control always automatically processes FILENAME-type commands; unlike URL-type commands, they cannot be disabled.
When the WMP control receives a TEXT-type command, it is ignored because the WMP control does not contain a captioning window to display the content of the command. You can still capture the TEXT-type command using the Event Handler.
When the WMP control receives an EVENT-type command, it searches for the NAME attribute of EVENTelements in the Advanced Stream Redirector (ASX) file. If the NAME attribute matches the second string of the script command, the WMP control executes the entries contained within the EVENT element. An example is to embed a script command for switching streams.
When the WMP control receives an OPENEVENT-type command, it checks the EVENT element in the ASX file and opens the matching title. It does not play the title until the WMP control receives the actual event of the same name from an EVENT-typecommand.
Last updated on Tuesday, May 18, 2004