One of the features of Microsoft NetShow Advanced Streaming format (ASF) is the ability to embed script commands into the stream. The embedded script commands are two Unicode strings associated with a designated time in the stream. One string specifies the type of command, and the other string contains the actual command. When the stream reaches the time associated with the command, the NetShow Player control issues an event that can be captured and processed by an event handling routine.
Both of the command strings are passed as parameters to the event handler. The type parameter is used to determine how the command parameter should be processed, and the command parameter specifies the action to be performed. For example, commands to launch URLs can be embedded into ASF streams. The type parameter for these commands is URL and the command parameter would contain the URL to be launched by the browser.
The Player control automatically handles the following types of embedded script commands;
Any type of command can be embedded into an ASF stream, and reciprocal code can be written for the client application to handle the command. Unknown types of commands are ignored by the Player control; however, they are still handed off to the event handling routine for processing.
The Encoder provides a Commands dialog box for embedding script commands into the ASF streams it is producing. Script commands entered into the Commands dialog box are dropped into the stream to be executed by the client application.
The Encoder Commands dialog box does have limitations. Once a command is sent, it is not retained in the Commands dialog box, requiring users to retype the command before it can be sent again. Another drawback is that it can not import commands stored in a script file.
About the Scripting Utility Sample
The scripting utility sample demonstrates how to design a Microsoft Visual Basic utility by using the methods and properties exposed through Automation for embedding script commands. It provides an easy–to-use interface for embedding commands into an ASF stream. The utility provides the following features, which extend the functionality of the standard interface:
The utility also incorporates the following features of the Encoder:
Sample Components
The sample components are installed by clicking the link specified below. The following components are downloaded when the sample is installed:
Requirements
The sample uses an .asd file containing the settings needed by the Encoder. Currently there is no programmatic way to create an .asd file. Use the Encoder to perform this task. For more information about creating an .asd file to specify the settings, see the Encoder documentation. The .asd file must specify the following settings:
To Use the Utility
The steps outlined below demonstrate how to use the utility:
No error codes are returned when the script command is sent. The best way to determine if the command was received and processed successfully is by observing the results on a NetShow Player connected to the Encoder. The Web page included with this sample is ideal for testing the output generated from the Encoder. Instructions for using the Web page are outlined below.
Creating a Sample Script File
Any text editor can be used to create a script file used by the scripting utility. The following list outlines the format of a script file:
Viewing Output on the Sample Web Page
The Web page included with the sample uses two frames. One frame (Frame1.htm) contains the embedded player and the other (Frame2.htm) is available for launching URL commands received from the scripting utility. Launching URLs in Frame2 allows the player to continue rendering the stream from the Encoder in Frame 1.
While it is possible to run the sample utility and the Web page on the same computer, running the Encoder and the scripting utility on one computer and the sample Web page on another computer is recommended.
The following list outlines the steps for using the Web page:
Troubleshooting
The status bar at the bottom of the sample utility displays whether or not the .asd file is loaded and whether or not encoding has started.
The Start Encoding option remains disabled until a valid .asd file is loaded.
The Send Command button remains disabled until the encoding process starts successfully.
If the Encoder can not be started from the utility ,or script commands are not being processed as expected on the sample Web page, try the following steps:
Installing the Sample
You can download this sample by linking to http://www.microsoft.com/netshow/download/rtescript.exe.
These examples illustrate how to use HTML and the Visual Basic Scripting Edition, with attributes exposed by Microsoft NetShow. They may not be fully functional within the Platform SDK framework. To download the complete suite of NetShow products, which includes working samples, visit the NetShow web site (http://www.microsoft.com/NetShow)
© 1996-1998 Microsoft Corporation. All rights reserved.