Processing Embedded Script Commands

One compelling feature of ASF streams is the script commands that can be delivered to the Media Player control along with the audio and video streams. These script commands are a pair 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 type-specific command to process. When the stream reaches the time associated with a command, the Player control sends a ScriptCommand event to the container. An event-handling routine can be written to respond to this event. The script-command strings are passed to the event handler as parameters of the ScriptCommand event.

Two types of embedded script commands, URL and FILENAME, are automatically processed by the Player control. Event-handling routines are not needed to process commands with URL and FILENAME types.

URL-type Commands

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. If the frame is not specified in the script command, the DefaultFrame property determines which frame the new URL is launched in.

Note: If frames are not used, or if the URL-type command is launched in the same frame as the Player control, the page rendering the stream is replaced by the URL specified by the script command.

Automatic processing of URL-type script commands can be enabled or disabled by setting the InvokeURLs property. If this property is set to FALSE, the URL-type command is ignored by the control; however, the ScriptCommand event is still sent to the container.

URL-type script commands specify the relative location of the URL. A base HTTP URL can be specified by the BaseURL property. The Player control concatenates the base URL with the relative URL. The result is a fully specified URL that is passed as the command parameter of the ScriptCommand event.

FILENAME-type Commands

When a script command with the FILENAME type is received by the Player control, the FileName property is set to the value specified by the command. Then the control opens the file and begins rendering the stream from the new location. The control always automatically processes FILENAME-type commands; they can not be disabled like URL-type commands.

© 1996-1998 Microsoft Corporation. All rights reserved.