I found this.... Adding Script Commands to Windows Media Files
Microsoft Corporation
Updated November 2000
One of the most powerful features of Microsoft® Windows Media™ Technologies is the ability to embed script commands within a stream. By doing this, you can do anything that Microsoft Visual Basic® Scripting Edition (VBScript) or JavaScript can do, from firing events within the browser to calling events within other ActiveX® controls.
Adding script command functionality to a Web page is a two-part process:
Add commands to the media
You can use one of several encoding tools to add commands to your digital media. When the tool encodes or saves the file or live stream, the commands are saved with the media.
Handle commands in a Web page
Script handles the script command event raised by the Player object. You add the event script, object elements, and cross-browser script that makes it possible for the command to be handled by either the ActiveX control or plug-in.
This article covers adding commands to the media with the following topics:
Encoding Tools for Adding Script Commands
Adding Commands with Windows Media ASF Indexer
For More Information
Encoding Tools for Adding Script Commands
Adding script commands to your digital media involves entering a time for the command to happen, a Type string, and a Parameter string. There are a few reserved Types, such as URL, TEXT, and EVENT, but aside from these the Type string can be anything you want, as long as you have the VBScript or JavaScript code necessary to interpret it in your Web page. How you get the Type and Parameter strings into the stream depends on what tool you use to create your Windows Media-based content. The following table describes the tools that you can use to add script commands:
Company Name and Tool Name Description
Windows Media Encoder Add commands on the fly as you encode from a capture card. Microsoft Windows Media Encoder is the only tool with which you can add commands to a live stream.
First, enable script commands in a session or encoding profile. Then, enter text into the Script panel and click Insert when you want to send the command.
Windows Media ASF Indexer Add script commands to a chronologically ordered list, and adjust the timing of the commands by editing the list or by dragging commands to new positions on a graphical timeline display. With ASF Indexer you can only open and edit Windows Media files.
Windows Media Advanced Script Indexer Add script commands to a list, and adjust timing by editing items in the list. You can only open and edit Windows Media files.
ASFChop ASFChop is a utility that gives you most of the same functionality as Windows Media ASF Indexer, but from a command line. Create a script file in Microsoft Notepad or your favorite text editor. Then, compile a Windows Media file with the - script switch added to the command-line prompt, followed by the path and name of the script file.
This is an example command prompt line:
asfchop -in wavfile.wmv -out newasf.wmv -script scriptfile.txt
Sonic Foundry Sound Forge is a third-party tool. Add script commands to a graphical representation of the audio waveform of an audio or video file. With Sound Forge, you can edit the audio characteristics of a media file, such as an AVI or WAV file, and then encode the media and commands to a Windows Media file. You cannot edit a Windows Media file directly.
Windows Media files can also be encoded with other Sonic Foundry products, such as Stream Anywhere and ACID.
Terran Cleaner 5 is a third-party camera-to-Web streaming solution. With Cleaner 5 you can capture, add script commands, encode, and publish Windows Media files.
For complete information on how to use any of these tools, see the online Help documentation that is included with each program. Windows Media ASF Indexer, Windows Media Advanced Script Indexer, and ASFChop are part of the Windows Media Resource Kit, and complete documentation is included with the installation of the kit. The Windows Media Resource Kit and Windows Media Encoder can be downloaded from the Windows Media Web site.
Adding Commands with Windows Media ASF Indexer With Windows Media ASF Indexer, you can add script commands, as well as markers and text properties to digital media that has already been encoded as a Windows Media file. In this section, you will see how easy it is to add and edit script commands with this tool. The knowledge you gain here will help you when using any of the other encoding tools to add script commands.
Note Markers are similar to bookmarks. You can add markers to a Windows Media file and end users can use them to navigate to different parts of the digital media with Windows Media Player.
To use Windows Media ASF Indexer
Check the file name extension of the file that you want to add commands to. If the extension is .wma or .wmv, rename the file with an .asf extension. ASF Indexer does not currently recognize the .wma and .wmv file name extensions.
Locate the program file asfindxr.exe on your computer and open it. If you used the default settings when you installed the Windows Media Resource Kit, click Start, click Run, and then type the following path: c:\Program Files\Windows Media Components\Tools\asfindxr.exe.
To add a script command
On the File menu, click Open, and then open the file with the .asf file name extension.
Play the file to the point where you want the script command to occur, and then click the pause button.
On the Edit menu, click Edit Script Commands. In the Script Commands dialog box, click New, and then enter the following information:
Time
The time when you want the script command to occur.
Type Select a type from the list or enter a custom type. For example, you may want to change text in two separate text boxes. You can enter the type Textbox1 to be associated with text you want to appear in the first text box and Textbox2 with the second text box.
Parameter
The command or text string that you want to be associated with the type. For example, if the type you entered is URL, the parameter is a URL; if the type you entered is CAPTION, the parameter is a text string that you will use as a caption.
Close the dialog boxes.
Notice that the script command appears on the Script Command Timeline as a green icon. You can drag the icon to change the time at which the script command occurs.
To edit a script command
On the Edit menu, click Edit Script Commands.
Click the command that you want to edit, and then click Edit.
Make any changes, and then close the dialog boxes.
To save script commands in the file
On the File menu, click Save.
After saving the file with the new script commands, rename the file with the previous file name extension, .wma or .wmv.
When the file plays back, Windows Media Player handles the script commands as they occur. Certain key command types, such as URL and CAPTION, are handled within Windows Media Player. If the Player is embedded in a Web page, commands are handled by your event scripting.
For More Information
For more scripting information and code samples, see the Windows Media section of the MSDN Online Samples area. |