Windows Media Player SDK banner art
PreviousNext

Player.scriptCommand event

The scriptCommand event occurs when a synchronized command or URL is received.

Syntax

scriptCommand(scType, Param)

Parameters

  scType

String specifying the type of script command.

  Param

String specifying the script command.

Remarks

Commands can be embedded among the sounds and images of an .asf file. The commands are 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. One parameter specifies the type of command being sent, and the other parameter specifies the command. The type of parameter is used to determine how the command parameter is processed. 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). URL-type commands received by the player control are invoked automatically in your default Internet browser if the invokeURLs property is set to true.

The player control always processes incoming URL-type commands in the following manner:

  1. A URL-type command is received.
  2. scriptCommand is called.
  3. After scriptCommand returns, invokeURLs is checked.
  4. If invokeURLs is true and the command is a URL-type, the specified URL is invoked. If invokeURLs is false or if the command is not a URL-type, the command is ignored.

When authoring an .asf file, you can specify which frame the new URL is displayed in by concatenating 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 must be launched in the myframe frame.

scType = "URL"
Param = http://myweb/mypage.html&&myframe

The other types of script commands automatically processed by the player control include FILENAME, TEXT, EVENT, and OPENEVENT.

You can embed any other type of command as long as you provide reciprocal code to handle the command. Though unknown commands are ignored by the player control, they are still handed off to the scriptCommand event.

The scriptCommand event is not called if the file is being scanned (fast-forwarded or fast-reversed).

The value of event parameters is specified by the player, and can be accessed or passed to a method in an imported JScript file using the parameter name given. This parameter name must be typed exactly as shown, including capitalization.

See Also

PreviousNext


© 2000-2001 Microsoft Corporation. All rights reserved.