The following sample code can be pasted into a Visual Basic application. The code is separated into three parts:
Minimal error checking is included.
The following tasks must be completed before the client application can run.
Note that the declaration of the Real-Time Encoder object (RTE) is outside of the private subroutines. The object must be created and started to read the properties.
Dim RTE As Object
Private Sub Start_Click()
On Error Resume Next
Set RTE = CreateObject("Asf.RealTimeEncoder")
If Err.Number Then MsgBox "Object not loaded."
RTE.LoadASD("c:\Sample.asd")
If Err.Number Then MsgBox "ASD file not loaded."
RTE.Start
Encoding.Visible = True
End Sub
Private Sub Stop_Click()
On Error Resume Next
RTE.Stop
Set RTE = Nothing
Encoding.Visible = False
End Sub
Private Sub DoReport_Click()
On Error Resume Next
If Not RTE.IsStarted Then MsgBox "RTE not running": Exit Sub
Report.Text = "The Real-Time Encoder has started."
Report.Text = Report.Text & vbCrLf & "Description: " & RTE.Description
Report.Text = Report.Text & vbCrLf & "IP Port: " & RTE.IPPort
Report.Text = Report.Text & vbCrLf & "AllowScripts: " & RTE.AllowScript
Report.Text = Report.Text & vbCrLf & "AllowVideo: " & RTE.AllowVideo
Report.Text = Report.Text & vbCrLf & "AllowAudio: " & RTE.AllowAudio
Report.Text = Report.Text & vbCrLf & "ImageWidth: " & RTE.ImageWidth
Report.Text = Report.Text & vbCrLf & "ImageHeight: " & RTE.ImageHeight
Report.Text = Report.Text & vbCrLf & "FramesPerSecond: " & RTE.FramesPerSecond
Report.Text = Report.Text & vbCrLf & "SecondsPerIFrame: " & RTE.SecondsPerIFrame
Report.Text = Report.Text & vbCrLf & "BitsPerPixel: " & RTE.BitsPerPixel
Report.Text = Report.Text & vbCrLf & "VideoInputFOURCC: " & RTE.VideoInputFOURCC
Report.Text = Report.Text & vbCrLf & "DelayBuffer: " & RTE.DelayBuffer
Report.Text = Report.Text & vbCrLf & "AudioFormatTag: " & RTE.AudioFormatTag
Report.Text = Report.Text & vbCrLf & "AudioSource: " & RTE.AudioSource
Report.Text = Report.Text & vbCrLf & "VideoCodecFOURCC: " & RTE.VideoCodecFOURCC
Report.Text = Report.Text & vbCrLf & "Bandwidth: " & RTE.Bandwidth
Report.Text = Report.Text & vbCrLf & "InputSourceFile: " & RTE.InputSourceFile
If RTE.IsNetEnabled Then
Report.Text = Report.Text & vbCrLf & "NetShowServer: " & RTE.NetShowServer
Report.Text = Report.Text & vbCrLf & "StreamAlias: " & RTE.StreamAlias
Report.Text = Report.Text & vbCrLf & "NumClients: " & RTE.NumClients
EndIf
If RTE.IsRecording Then
Report.Text = Report.Text & vbCrLf & "RecordDuration: " & RTE.RecordDuration
Report.Text = Report.Text & vbCrLf & "RecordMaxSize: " & RTE.RecordMaxSize
Report.Text = Report.Text & vbCrLf & "RecordSize: " & RTE.RecordSize
Report.Text = Report.Text & vbCrLf & "RecordFileName: " & RTE.RecordFileName
EndIf
End Sub
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.