Magazine |
| | Community |
| | Workshop |
| | Tools & Samples |
| | Training |
| | Site Info |
Samples
|
NetShow ServicesCaptioning using an HTML TextArea (VBScript) |
||||
Demo | ||||
Description
GOAL: Change the text in an HTML TextArea with events streamed from a Windows NT Server running NetShow Services. This is done by creating an .ASF file that contains script events referring to a VbScript subroutine that then updates the value of the HTML textbox. This demo uses a different procedure for Netscape and for Internet Explorer.
CODE TO PUT IN YOUR HTML:
First, you will need to include the All-Browser Friendly code in your Web page. Because you are using VBScript and script events, this demo will only work in Internet Explorer. However, the All Browser Friendly will work in both Internet Explorer and Netscape Navigator. This will allow the user to see the video even if they are not receiving the script events. Add the code below to your Web page between the <BODY> and </BODY> tags. Replace "your-file.asx" with the path of a file on your local hard drive or a file on a Windows NT Server running NetShow Services.
<OBJECT ID="MediaPlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <PARAM NAME="FileName" VALUE="http://server/path/your-file.asx"> <PARAM NAME="AnimationatStart" VALUE="true"> <PARAM NAME="TransparentatStart" VALUE="true"> <PARAM NAME="AutoStart" VALUE="true"> <PARAM NAME="ShowControls" VALUE="1"> <Embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="http://server/path/your-file.asx" Name=MediaPlayer ShowControls=1 Width=360 Height=180 > </embed> </OBJECT> <BR><BR> <a href="http://servername/path/your-file.asx"> Start the streaming media presentation in the stand-alone player.</a>Add the following JavaScript code after the </TITLE> tag. This will reload your Netscape plug-in so it will play better.
<script language="JavaScript"> <!-- if ( navigator.appName == "Netscape" ) { navigator.plugins.refresh(); document.write("\x3C" + "applet MAYSCRIPT Code=NPDS.npDSEvtObsProxy.class" ) document.writeln(" width=5 height=5 name=appObs\x3E \x3C/applet\x3E") } //--> </script>You will need to add a VBScript subroutine that will receive the script events and assign them to variables which can then be used in the VBScript code. This code assigns two variables; The first variable is used to define the name of the script event. The second variable is used to define a parameter of that script event. In the following code, an IF statement is used to assign the parameter to the TextArea called "textbox1". If the scType is equal to "Textbox", then the value of the textarea (named textbox1) is changed to the value of scParam.
<script LANGUAGE="VBScript"> ' 'this is for the first streamed event sub MediaPlayer_ScriptCommand(scType,scParam) if scType= "Textbox" then textbox1.value = scParam end if end sub </script>
Time | Event | Parameter |
---|---|---|
00:00.10.0 | Textbox | This script event just happened. |