IWMSBroadcastPublishingPoint.AnnounceToNSCFile (Visual Basic .NET)
The AnnounceToNSCFile method creates a multicast announcement (.nsc) file that is required for a client to connect to a multicast 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.
IWMSBroadcastPublishingPoint.AnnounceToNSCFile(
strDestinationFileName As String,
fOverwriteFlag As Boolean
)
Arguments
strDestinationFileName |
[in] String containing the name of the file used to announce the multicast broadcast. This file must have an .nsc file name extension. |
fOverwriteFlag |
[in] Boolean indicating whether the file should be overwritten if it already exists. There is no default value for this parameter. |
Return Value
If this method succeeds, it does not return a value. If it fails, it returns an error number.
Number |
Description |
---|---|
0x8007000E |
There is insufficient memory to complete the function. |
0x00000003 |
The path indicated by the strDestinationFileName could not be found. |
0xC00D1459L |
This feature is not supported on this operating system. |
0xC00D138DL |
AnnounceToNSCFile was called before Announce was called. |
0xC00D145AL |
The publishing point has already been removed. |
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 AnnounceToNSCFile method to provide players a file with an .nsc extension. This file contains a multicast address, a port number, a rollover URL, source content headers, and so on.
Before calling the AnnounceToNSCFile method, you must add the names of all of the media files included in the multicast to the IWMSAnnouncementStreamFormats IWMSAnnouncementStreamFormats Object (Visual Basic .NET) collection and call the IWMSBroadcastPublishingPoint.Announce method.
This method requires the Network Service account to have write and browse access to the specified path. This method is required for a multicast broadcast but not for a unicast broadcast.
Example
Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices
Private Sub CreateNSCFile()
' Declare variables.
Dim Server As WMSServer
Dim PubPoints As IWMSPublishingPoints
Dim PubPoint As IWMSPublishingPoint
Dim BCPubPoint As IWMSBroadcastPublishingPoint
Dim strFile As String
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 file that clients can use
' to connect to the publishing point.
strFile = "C:\wmpub\wmroot\announce.nsc"
BCPubPoint.AnnounceToNSCFile(strFile, True)
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
Reference
IWMSAnnouncementStreamFormats Object (Visual Basic .NET)