ScriptCommand

This event occurs when the Windows Media Player control receives a synchronized command or URL.

Compatibility: Windows Media Player

<SCRIPT FOR="MediaPlayer" EVENT="ScriptCommand(sType, sParam)" LANGUAGE="JScript">
  //insert script commands//
</SCRIPT>

Parameters

  • sType
    String value specifying the type of script command.
  • sParam
    String value specifying the value of the script command.

Remarks

Commands can be embedded among the sounds and images of an .asf file. A command is a pair of Unicode strings associated with a designated time in the stream. When the stream reaches the time associated with the command, the Windows Media Player control sends a ScriptCommand event with two parameters. The sType parameter specifies the type of command and the sParam parameter specifies the command. The type parameter determines how the Windows Media Player control processes the command parameter. Any type of command can be embedded in an ASF stream to be handled by the ScriptCommand event.

One type of command is a URL (Uniform Resource Locator). The Windows Media Player control automatically invokes URL-type commands in your default browser if the InvokeURLs property is true.

The Windows Media Player control always processes incoming URL-type commands in the following manner:

The control receives the embedded script command.

The ScriptCommand event occurs.

If InvokeURLs is true and the command is a URL-type, the control invokes the specified URL. If the command is a URL-type but InvokeURLs is false, the command is ignored.

All other event types are processed by the Media Player by default.

When you author an .asf file, you can specify the frame in which the new URL is displayed by appending two ampersands and the name of the frame in the parameter field. The example below illustrates typical ScriptCommand parameters. It specifies that the URL mypage will be launched in the frame myframe.

Type = "URL"
Param = "http://example.microsoft.com/mypagel&&myframe"

Other types of script commands automatically processed by the Windows Media Player control include FILENAME, TEXT, EVENT, and OPENEVENT commands. For the FILENAME type, the Windows Media Player control resets the FileName property, attempts to open the specified file, and begins playing the new stream immediately. For the TEXT type, the Windows Media Player control displays the associated text in the captioning window of the Windows Media Player. For the EVENT type, the Windows Media Player control executes instructions defined for the specified event. For the OPENEVENT type, the Windows Media Player buffers the associated EVENT-type command for execution when it receives the corresponding EVENT from the ASF stream.

You can embed any other type of command as long as you provide corresponding code to handle it. The Windows Media Player control ignores unknown command types, but still hands them off to the ScriptCommand event.

This event does not occur if the file is being scanned (fast-forwarded or fast-reversed).

Requirements

OS Versions: Windows CE 3.0 and later.

See Also

Windows Media Player Events | Compatibility Modes

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.