WMEncoder.SendScript
The SendScript method sends script commands.
Syntax
WMEncoder.SendScript(iIndex, strType, strData)
Parameters
iIndex
[in] Integer containing the index of the script to send. This value must be 0.
strType
[in] String containing the type of script to send.
strData
[in] String containing the script content.
Return Values
This method does not return a value.
Remarks
Because multiple text streams are not currently supported, you must set the iIndex parameter to 0.
The following are examples of script commands that you can use with Windows Media Player.
Script command | Description |
TEXT or CAPTION | The data string is displayed in the captioning window of Windows Media Player. |
URL | The data string is interpreted as a URL and is opened in the user's default Web browser. |
FILENAME | Windows Media Player opens the media file specified in the data string. |
EVENT | Windows Media Player executes the instructions defined for the specified event. |
OPENEVENT | Windows Media Player buffers the EVENT specified in the data string for timely execution of the EVENT script. Windows Media Player looks to the EVENT element in the playlist and begins buffering the clip or stream defined in the EVENT element. Windows Media Player then holds this information until the actual event of the same name. When the named event is received, Windows Media Player switches to that previously buffered content. |
Example Code
' Create a WMEncoder object.
Dim Encoder As WMEncoder
Set Encoder = New WMEncoder
' Declare a source group object and a source group collection object.
' Get the source group collection object from the WMEncoder object.
Dim SrcGrpColl As IWMEncSourceGroupCollection
Dim SrcGrp As IWMEncSourceGroup
Set SrcGrpColl = Encoder.SourceGroupCollection
' Add an empty source group to the source group collection.
Set SrcGrp = SrcGrpColl.Add("SG_1")
' Add video, audio, and script streams to the new source group.
Dim SrcAud As IWMEncSource
Dim SrcVid As IWMEncSource
Dim SrcScript As IWMEncSource
Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
Set SrcScript = SrcGrp.AddSource(WMENC_SCRIPT)
' Specify the plug-in to use for capturing audio and video
' streams from the capture card.
SrcVid.SetInput "DEVICE://Default_Video_Device"
SrcAud.SetInput "DEVICE://Default_Audio_Device"
' Specify the script plug-in.
SrcScript.SetInput "UserScript://"
' Select a custom profile for the source group. The profile must be
' enabled for script streams. You can use either the Windows
' Media Encoder UI or the WMEncProfile2 object to create the
' profile. Because this is a custom profile, you can
' associate it with a source group by specifying the path and
' name.
SrcGrp.Profile = "C:\Program Files\Windows Media Components\ _
Encoder\Profiles\profile_name.prx"
' Start the encoding process.
Encoder.Start
' Broadcast a text string. This is displayed in the Windows
' Media Player caption window.
Encoder.SendScript(0, "TEXT", "This is a test")
Requirements
Reference: Windows Media Encoder
Library: wmenc.exe
See Also