Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.gif)
| Previous | Next |
IWMSBroadcastPublishingPoint.AnnounceToNSCStream (Visual Basic .NET)
The AnnounceToNSCStream method retrieves an UCOMIStream object containing a file stream that can be used by a client to receive and render a broadcast.
- Note This method is available only on Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008 Enterprise; and Windows Server 2008 Datacenter.
Syntax
UCOMIStream = IWMSBroadcastPublishingPoint .AnnounceToNSCStream()
Parameters
This method takes no parameters.
Return Values
This method returns an UCOMIStream object containing the NSC file stream.
Remarks
Players cannot connect directly to a server to render a multicast stream. Therefore, to obtain the information required to receive a multicast broadcast, you must use the AnnounceToNSCStream or AnnounceToNSCFile method to provide players the necessary information. This stream contains a multicast address, a port number, a rollover URL, source content headers, and so on.
Before calling the AnnounceToNSCStream method, you must add the names of all of the media files included in the multicast to the IWMSAnnouncementStreamFormats object collection and call the IWMSBroadcastPublishingPoint.Announce method.
Example Code
Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices
Private Sub GetAnnouncementStream()
Imports System.Runtime.InteropServices
Imports System.Text
' Declare variables.
Dim Server As WMSServer
Dim PubPoints As IWMSPublishingPoints
Dim PubPoint As IWMSPublishingPoint
Dim BCPubPoint As IWMSBroadcastPublishingPoint
Dim Dec As Decoder = Encoding.UTF8.GetDecoder()
Dim oStream As UCOMIStream
Dim StreamStats As STATSTG
Dim Bytes As Byte()
Dim Chars As Char()
Dim iChars As Integer
Dim i As Integer
Try
' Create the WMSServer object.
Server = New WMSServer()
' Retrieve the IWMSPublishingPoints object.
PubPoints = Server.PublishingPoints
' Retrieve each publishing point and retrieve the
' IWMSBroadcastPublishingPoint object.
For i = 0 To Server.PublishingPoints.Count – 1
PubPoint = PubPoints.Item(i)
If PubPoint.Type = _
WMS_PUBLISHING_POINT_TYPE.WMS_PUBLISHING_POINT_TYPE_BROADCAST Then
BCPubPoint = PubPoint
Exit For
End If
Next i
' Retrieve the announcement stream that clients can use
' to connect to the publishing point.
BCPubPoint.Announce()
oStream = BCPubPoint.AnnounceToNSCStream()
oStream.Stat(StreamStats, 0)
Bytes = Array.CreateInstance(GetType(Byte), StreamStats.cbSize)
oStream.Read(Bytes, StreamStats.cbSize, Nothing)
iChars = Dec.GetCharCount(Bytes, 0, StreamStats.cbSize)
Chars = Array.CreateInstance(GetType(Char), iChars)
iChars = Dec.GetChars(Bytes, 0, StreamStats.cbSize, Chars, 0)
Dim strBuf As String = New String(Chars, 0, StreamStats.cbSize)
Catch excCom As COMException
' TODO: Handle COM exceptions.
Catch exc As Exception
' TODO: Handle errors.
Finally
' TODO: Clean-up code goes here.
End Try
End Sub
Requirements
Reference: Add a reference to Microsoft.WindowsMediaServices.
Namespace: Microsoft.WindowsMediaServices.Interop.
Assembly: Microsoft.WindowsMediaServices.dll.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003 family, Windows Server 2008 family.
See Also
- IWMSAnnouncementStreamFormats Object (Visual Basic .NET)
- IWMSBroadcastPublishingPoint Object (Visual Basic .NET)
- IWMSBroadcastPublishingPoint.Announce (Visual Basic .NET)
| Previous | Next |