IWMEncPushDistribution.GenerateMulticastInfoFile

Windows Media Encoder SDK banner art

The GenerateMulticastInfoFile method generates a file containing multicast information.

Syntax

void IWMEncPushDistribution.GenerateMulticastInfoFile(
  string  bstrNSCFileName
);

Parameters

bstrNSCFilename

[in]  String specifying the name of the .nsc file.

Return Values

This method does not return a value.

If this property fails, it returns an error number.

Return code Number Description
E_INVALIDARG 0x80070057 The server name or the publishing point is empty.
NS_E_SERVER_NOT_FOUND 0xC00D0035L The specified server could not be found.

Remarks

The GenerateMulticastInfoFile method generates an .nsc file, which contains information that enables players to access and decode the multicast stream, including the IP address, port, and stream format information, as well as the publishing point you specified in the PublishingPoint property. Then use the GenerateAnnouncementFile method to generate the announcement (.asx) Windows Media file.

If you make the multicast information (.nsc) file available from your Web server, be sure to configure the Web server to either disallow caching of the file or require a freshness check when cached by a client to prevent players from using outdated multicast information.

Note You must have access permission to the Windows Media Services service through DCOM, and the encoding computer must have write access on the Windows Media server to be able to push a stream to it. For more information about configuring publishing points, see the Windows Media Services Help.

Example Code

using WMEncoderLib;

try
{
// Create a WMEncoder object.
  WMEncoder Encoder;
  Encoder = new WMEncoder();

// Configure the encoding session including the input sources and profile.

// Create a push distribution object.
  IWMEncPushDistribution PushDist;
  PushDist = (IWMEncPushDistribution)Encoder.Broadcast;

// Declare variables. 
  string sServerName;
  string sPubPoint;
  string sPubTemplate;
  string sBrdcstInfo;
  string sMyNSCFile;
  string sMyNSCURL;
  string sMyASXFile;

// Provide values for the following variables.
  sServerName = "YOURSERVERNAME:PORTNUMBER";
  sPubPoint = "PUBLISHING_POINT_NAME";
  sPubTemplate = "EXISTING_PUBLISHING_POINT_NAME";
  sBrdcstInfo = "NAME OF THE BROACAST INFORMATION FILE";
  sMyNSCFile = "NAME OF THE NSC FILE TO CREATE";
  sMyNSCURL = "URL TO THE NSC FILE YOU CREATE";
  sMyASXFile = "NAME OF THE ANNOUNCMENT FILE";

// Specify the server name, publishing point, an existing publishing
// point, and then generate an .nsc file and announcement file. 
  PushDist.ServerName = sServerName;
  PushDist.PublishingPoint = sPubPoint;
  PushDist.Template = sPubTemplate;

// Specify whether to destroy the publishing point.
  PushDist.AutoRemovePublishingPoint = true;

// Initialize the encoding session.
  Encoder.PrepareToEncode(true);

// Generate the announcement file.
  PushDist.GenerateMulticastInfoFile(sMyNSCFile);
  PushDist.GenerateAnnouncementFile(sMyNSCURL, sMyASXFile);

// Start encoding.
  Encoder.Start();
}

catch (Exception e)
{
     // TODO: Handle exceptions.
}

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also