One of the features of Microsoft NetShow Active 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 Real-Time Encoder application provides a Commands dialog box for embedding script command 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 Real-Time Encoder Commands dialog box has 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 Visual Basic utility using the methods and properties exposed through OLE 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 Real-Time Encoder application:
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 Active Streaming descriptor (ASD) file containing the settings needed by the Real-Time Encoder. Currently there is no programmatic way to create an ASD file; use the NetShow Real-Time Encoder application to perform this task. For more information about creating an ASD file to specify the settings, see the NetShow Real-Time Encoder documentation. The ASD file must specify the following settings:
Using the Utility
The steps outlined below demonstrate how to use the utility:
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 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 Real-Time 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 Real-Time 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.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.