Skip to content

platform sdk archiver role

Andre Lafleur edited this page Oct 8, 2026 · 11 revisions

About Archiver and Auxiliary Archiver roles

An ArchiverRole records video from its assigned cameras. An AuxiliaryArchiverRole records selected cameras for redundancy or in a separate storage location. Both inherit common role, server, and per-camera statistics members from ArchiverRoleBase.

Which cameras does this Archiver role manage?

Use ArchiverRole.Cameras to identify the cameras attached to the role.

ArchiverRole archiver = engine.GetEntity<ArchiverRole>(archiverGuid);

Console.WriteLine($"Archiver: {archiver.Name} ({archiver.Cameras.Count} cameras)");
foreach (Guid cameraGuid in archiver.Cameras)
{
    Camera camera = engine.GetEntity<Camera>(cameraGuid);
    Console.WriteLine($"  Camera: {camera.Name}");
}

To move a camera's parent video unit to a different Archiver role, use Engine.ActionManager.MoveVideoUnit(VideoUnit unit, ArchiverRole destination).

Which defaults do cameras inherit from this Archiver role?

ArchiverRole.RecordingConfiguration provides recording defaults for cameras whose Camera.RecordingConfiguration.UseCustomRecordingSettings is false. Set these defaults on the Archiver role to apply them to cameras that inherit role settings.

IArchiverRecordingConfiguration defaults = archiver.RecordingConfiguration;

Console.WriteLine($"Default retention: {defaults.RetentionPeriod}");
Console.WriteLine($"Pre-event buffer: {defaults.PreEventRecordingTime}");
Console.WriteLine($"Post-event recording: {defaults.PostEventRecordingTime}");

For the full recording configuration and camera-specific overrides, see About cameras. Recording configuration includes audio recording, automatic cleanup, scheduled modes, redundancy, and encryption.

Which stream does an Auxiliary Archiver role record?

AuxiliaryArchiverRole.RecordingConfiguration provides shared recording settings for audio, recording times, retention, automatic cleanup, and scheduled modes. VideoStream selects the stream that the Auxiliary Archiver role records for each camera. The Auxiliary Archiver role's configuration does not include the redundancy or encryption settings available on the Archiver role. Set VideoStream to StreamingType.LowQuality to record the low-quality stream redundantly:

AuxiliaryArchiverRole aux = engine.GetEntity<AuxiliaryArchiverRole>(auxGuid);
IAuxRecordingConfiguration config = aux.RecordingConfiguration;

config.VideoStream = StreamingType.LowQuality;

Which server currently hosts this Archiver role?

These members describe the role's configured and active servers:

  • RoleServers returns the configured servers in failover priority order.
  • AgentServers returns the servers where the role's agent is active.
  • CurrentServer returns the server currently hosting the role.
  • ArchiverRole.PrimaryServerGuid returns the primary server for a multi-server deployment. AuxiliaryArchiverRole does not provide this property.

Note

RoleServers, CurrentServer, and ArchiverRole.PrimaryServerGuid are read-only. The Platform SDK does not provide a method to change an Archiver role's server priority or promote a selected server to become the current server.

How do I detect recording failure before querying archives?

ArchiverRole.ArchiverStatisticsCollection and AuxiliaryArchiverRole.ArchiverStatisticsCollection expose runtime statistics for each server. Per-camera details are available in each server's disk-group and encoder statistics. Check ArchiverEncoderStatistics.Description against RecordingProblem.None. A value other than RecordingProblem.None indicates a recording problem before a gap appears in ArchiverEventQuery results.

IArchiverStatisticsCollection stats = archiver.ArchiverStatisticsCollection;
IArchiverStatistics serverStats = stats[archiver.CurrentServer];

foreach (ArchiverDiskGroupStatistics group in serverStats.DiskGroupStats)
{
    foreach (ArchiverEncoderStatistics encoder in group.EncoderStats)
    {
        if (encoder.Description != RecordingProblem.None)
        {
            Console.WriteLine($"Encoder {encoder.Guid}: {encoder.Description}");
        }
    }

    Console.WriteLine($"Disk load: {group.TotalLoadPercentage:N0}%");
    Console.WriteLine($"Estimated remaining: {group.EstimatedRemainingRecordingTime}");
}

IArchiverStatistics provides NetworkIncomingBitrate, NetworkOutgoingBitrate, ArchivingCameras, ActiveCameras, and DiskGroupStats, which contains per-disk DiskStats and per-encoder EncoderStats details. ArchiverEncoderStatistics.Description contains the RecordingProblem value. To refresh the statistics, call Engine.ActionManager.RefreshArchiverStatistics(Guid archiver).

How do I receive warnings before automatic cleanup removes recorded files?

Set WarnWhenFilesWillBeDeleted and NbHoursAheadToWarnThatFilesWillBeDeleted to configure advance warnings before automatic cleanup removes recorded files:

archiver.WarnWhenFilesWillBeDeleted = true;
archiver.NbHoursAheadToWarnThatFilesWillBeDeleted = TimeSpan.FromHours(24);

Stream encryption certificates

Configure stream encryption for an Archiver role with certificates. IsEncryptionSupported reports whether the current server supports encryption. Set EncryptionType to select the encryption mode. Certificates returns the read-only collection of configured certificates. Use AddCertificates, RemoveCertificates, and ClearCertificates to manage the collection. Each of AddCertificates and RemoveCertificates accepts a params X509Certificate2[], an X509Certificate2Collection, or an IEnumerable<X509Certificate2>. ClearCertificates() takes no arguments and removes every certificate.

After your application loads an X509Certificate2, add it to the role:

X509Certificate2 cert = LoadCertificate();

archiver.AddCertificates(cert);

NTP

Configure the NTP source with ArchiverRole.NtpConfiguration, which returns an NtpSettings value. NtpSettings contains Server, Port, and PollTimeout; PollTimeout is measured in minutes and accepts values from 1 through 1,440. Create an NtpSettings value with new NtpSettings(server, port, pollTimeout) and assign it to NtpConfiguration.

See also

Platform SDK

Plugin SDK

Workspace SDK

Media SDK

Macro SDK

Web SDK

Synergis RIO

Media Gateway

Genetec Web Player

Clone this wiki locally