Compartir a través de


Creating a New Broadcast Publishing Point

The first step in publishing your content is to create a new publishing point that can be used to distribute it. The following Visual Basic .NET, C#, and C++ examples show you how to create a new broadcast publishing point named "NewPubPoint" and use it to publish content from a delivered from a Windows Media Encoder, by setting the content path to "Push:*". By modifying the values to fit your content, you can create your own personal broadcast publishing point.

Visual Basic .NET Example

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

' Declare variables.
Dim Server As WMSServer
Dim BCPubPoint As IWMSBroadcastPublishingPoint

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Add a new broadcast publishing point.
    BCPubPoint = Server.PublishingPoints.Add("NewPubPointVI", _
     WMS_PUBLISHING_POINT_CATEGORY.WMS_PUBLISHING_POINT_BROADCAST, _
     "http://encoder:port")

Catch errCom As COMException
    ' TODO: Handle COM exceptions.
Catch err As Exception
    ' TODO: Exception handler goes here.
Finally
    ' TODO: Clean-up code goes here.
End Try

C# Example

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

// Declare variables.
WMSServer Server;
IWMSBroadcastPublishingPoint BCPubPoint;

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

    // Add a new broadcast publishing point.
    BCPubPoint = (IWMSBroadcastPublishingPoint)Server.PublishingPoints.Add("NewPubPointVI",
        WMS_PUBLISHING_POINT_CATEGORY.WMS_PUBLISHING_POINT_BROADCAST, 
        "http://encoder:port");
}
catch (COMException comExc)
{
    // TODO: Handle COM exceptions.
}
catch (Exception exc)
{
    // TODO: Exception handler goes here.
}
finally
{
    // TODO: Clean-up code goes here.
}

C++ Example

#include <windows.h>
#include <atlbase.h>    // Includes CComBSTR.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer                    *pServer;
IWMSPublishingPoints          *pPubPoints;
IWMSPublishingPoint           *pPubPoint;
IWMSBroadcastPublishingPoint  *pBCPubPoint;

HRESULT         hr;
CComBSTR        bstrFile;
CComBSTR        bstrName;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPublishingPoints
// interface and add a new broadcast publishing point.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;

bstrName = "NewPubPoint";
bstrFile = "Push:*";
hr = pPubPoints->Add(bstrName, WMS_PUBLISHING_POINT_BROADCAST,
                     bstrFile, &pPubPoint);
if (FAILED(hr)) goto EXIT;

// Query the IWMSBroadcastPublishingPoint interface from
// the newly created publishing point.
hr = pPubPoint->QueryInterface(IID_IWMSBroadcastPublishingPoint,
                              (void **)&pBCPubPoint);
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

See Also

Reference

IWMSBroadcastPublishingPoint Interface

IWMSBroadcastPublishingPoint Object (C#)

IWMSBroadcastPublishingPoint Object (Visual Basic .NET)

Concepts

Publishing Broadcast Content