Share via


IWMSAdminArchiveSink.StartRecord (C#)

banner art

Previous Next

IWMSAdminArchiveSink.StartRecord (C#)

The StartRecord method starts the archiving process.

Syntax

  IWMSAdminArchiveSink
  .StartRecord();

Parameters

This method takes no parameters.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

Number Description
0x8000FFFF The WMS Archive Data Writer plug-in cannot be found.

Remarks

If the publishing point is stopped, the StartRecord method does not start it. You must therefore call IWMSBroadcastPublishingPoint.Start before calling StartRecord. Alternately, you can call IWMSBroadcastPublishingPoint.StartArchive to start both the publishing point and the archiving process.

The server does not raise a WMS_Publishing_Point_Event Class event when you call the StartRecord method.

Example Code

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

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSAdminArchiveSink AdminArchiveSink;
IWMSBroadcastPublishingPoint BCPubPoint; 

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

  // Retrieve the sample broadcast publishing point.
  BCPubPoint = (IWMSBroadcastPublishingPoint)Server.PublishingPoints["Sample_Broadcast"];

  // Stop the publishing point.
  BCPubPoint.Stop();

  // Specify the publishing point path.
  BCPubPoint.Path = "C:\\WMPub\\WMRoot\\Serverside_Playlist.wsx";

  // Retrieve the WMS Archive Data Writer plug-in.
  Plugin = BCPubPoint.BroadcastDataSinks["WMS Archive Data Writer"];

  // Make sure the plug-in is enabled.
  if (!Plugin.Enabled) Plugin.Enabled = true;

  // Retrieve the administrative interface for the plug-in.
  AdminArchiveSink = (IWMSAdminArchiveSink)Plugin.CustomInterface;

  // Specify the archive path template.
  AdminArchiveSink.Path = "%SystemDrive%\\WMPub\\WMArchive\\<V>\\Archive_<Y><m><d>.wmv";

  // Turn off the automatic start property.
  AdminArchiveSink.AutoStart = false;

  // Restart the publishing point and begin archiving.
  BCPubPoint.Start();
  AdminArchiveSink.StartRecord();

}

catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch(Exception e)
{
  //TODO: Handle errors.
}

finally
{
  // TODO: Cleanup code goes here.
}

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