IWMSAnnouncementStreamFormats Object (C#)

banner art

Previous Next

IWMSAnnouncementStreamFormats Object (C#)

The IWMSAnnouncementStreamFormats object contains a collection of media file paths and URLs. The files contain format information used to configure a multicast broadcast. Format information includes the codecs, bit rate, screen size, and so on, contained in the file header. One file per format must be specified. For example, if the multicast is made up of three files encoded in one format and five files encoded in another format, only two file paths must be added to the IWMSAnnouncementStreamFormats object, one to represent each format.

If a file path is added to the collection, it must identify a Windows Media file, a multicast configuration (.nsc) file, or a stream format file from Windows Media Encoder. If a URL is added to the collection, it must identify a single source such as a live Windows Media Encoder stream or a Windows Media file on an upstream server. However, it is not recommended that you specify a server-side playlist. The format added to the collection will be that represented by only the first entry in the playlist.

When a path or URL is added to the collection, the associated file is parsed to extract the format that a player must use to receive and render the content. The IWMSBroadcastPublishingPoint.Announce method adds the parsed information to the multicast configuration for the broadcast publishing point, the IWMSBroadcastPublishingPoint.AnnounceToNSCFile method generates a multicast announcement (.nsc) file, and the IWMSBroadcastPublishingPoint.AnnounceToNSCStream method generates multicast announcement information in an IStream object.

  • Note   This object is available only on Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; and Windows Server 2008.

The IWMSAnnouncementStreamFormats object exposes the following properties and methods.

Property Description
Count Retrieves the number of file names in the IWMSAnnouncementStreamFormats collection.
length Retrieves the number of file names in the IWMSAnnouncementStreamFormats collection. This property is provided for JScript compatibility.
Method Description
Add Adds a file name to the IWMSAnnouncementStreamFormats collection.
Remove Removes a file name, by index, from the IWMSAnnouncementStreamFormats collection.
RemoveAll Removes all file names from the IWMSAnnouncementStreamFormats collection.

In C#, there are two ways to access objects in a collection:

  • Access individual objects directly by using a string (where applicable)
  • Iterate through the objects by using an index

You must use array notation when retrieving objects from a collection, except when using the get_Item method.

Example Code

The following example illustrates how to retrieve an IWMSAnnouncementStreamFormats object.

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

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

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 IWMSAnnouncementStreamFormats object.
            AnnounceStreamFormats = BCPubPoint.AnnouncementStreamFormats;
            break;
        }
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

See Also

Previous Next