IWMSAnnouncementStreamFormats.Add (Visual Basic .NET)

The Add method adds a URL or a file path to the IWMSAnnouncementStreamFormats collection.

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.

IWMSAnnouncementStreamFormats.Add(
  strFileName As String
)

Arguments

strFileName

[in] String containing the URL or file path. Valid file names include those with an .asd extension.

Return Value

If this method succeeds, it does not return a value. If it fails, it returns an error number.

Number

Description

0x80070057

strFileName is an invalid argument. This can be returned if strFileName points to a directory or a playlist file.

0x00000002

The data source plug-in was not able to find the indicated file. This error is returned by the WMS File Data Source plug-in, but other plug-ins could return different error codes.

0x00000003

The path indicated by strFileName was not found.

0xC00D157EL

The server was not able to find an enabled data source plug-in to access the indicated file.

Remarks

The Add method also parses the associated media file to extract stream format information. The IWMSBroadcastPublishingPoint.Announce method then updates the server configuration with that information. The IWMSBroadcastPublishingPoint.AnnounceToNSCFile method retrieves the stream format information from the server configuration and uses it to create a file that a client can use to receive and render a multicast broadcast.

If a file path is added, 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, 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.

Example

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub AddStreamFile()

    ' Declare variables.
    Dim Server As WMSServer
    Dim PubPoints As IWMSPublishingPoints
    Dim PubPoint As IWMSPublishingPoint
    Dim BCPubPoint As IWMSBroadcastPublishingPoint
    Dim AnnounceStreamFormats As IWMSAnnouncementStreamFormats
    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 IWMSAnnouncementStreamFormats object.
    AnnounceStreamFormats = BCPubPoint.AnnouncementStreamFormats

    ' Add a file to the IWMSAnnoucementStreamFormats
    ' object for multicast broadcasting.
    strFile = "file://c:\wmpub\wmroot\welcome2.asf"
    AnnounceStreamFormats.Add(strFile)

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)

IWMSAnnouncementStreamFormats.Remove (Visual Basic .NET)

IWMSBroadcastPublishingPoint.Announce (Visual Basic .NET)

IWMSBroadcastPublishingPoint.AnnounceToNSCFile (Visual Basic .NET)