IWMSBroadcastPublishingPoint.AnnounceToNSCFile (C#)

banner art

Previous Next

IWMSBroadcastPublishingPoint.AnnounceToNSCFile (C#)

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; and Windows Server 2008.

Syntax

  IWMSBroadcastPublishingPoint
  .AnnounceToNSCFile(
  string  strDestinationFileName,
  bool  fOverwriteFlag
);

Parameters

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] bool indicating whether the file should be overwritten if it already exists. There is no default value for this parameter.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

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 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 Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer                       Server;
IWMSBroadcastPublishingPoint    BCPubPoint;
IWMSPublishingPoints            PubPoints;
IWMSPublishingPoint             PubPoint;

string                          strFile;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSPublishingPoints object.
    PubPoints = Server.PublishingPoints;

    // Retrieve each publishing point and retrieve the
    // IWMSBroadcastPublishingPoint object.
    for (int i = 0; i < PubPoints.Count; i++)
    {
        PubPoint = PubPoints[i];

        if (PubPoint.Type == 
            WMS_PUBLISHING_POINT_TYPE.WMS_PUBLISHING_POINT_TYPE_BROADCAST)
        {
            BCPubPoint = (IWMSBroadcastPublishingPoint)PubPoint;

            // Retrieve the announcement file that clients can use
            // to connect to the publishing point.
            strFile = "C:\\wmpub\\wmroot\\announce.nsc";
            BCPubPoint.AnnounceToNSCFile (strFile, true);
            break;
        }
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

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

Previous Next