Share via


IWMSAdminArchiveSink.StopRecord (C#)

banner art

Previous Next

IWMSAdminArchiveSink.StopRecord (C#)

The StopRecord method stops the archiving process.

Syntax

  IWMSAdminArchiveSink
  .StopRecord();

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

The server does not raise a WMS_Publishing_Point_Event Class event when you call the StopRecord 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 feature.
  AdminArchiveSink.AutoStart = false;

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

  // Record for 10 seconds.
  System.Threading.Thread.Sleep(10000);
  AdminArchiveSink.StopRecord();

}

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