Repository navigation
platform sdk archiver role
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.
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).
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.
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;These members describe the role's configured and active servers:
-
RoleServersreturns the configured servers in failover priority order. -
AgentServersreturns the servers where the role's agent is active. -
CurrentServerreturns the server currently hosting the role. -
ArchiverRole.PrimaryServerGuidreturns the primary server for a multi-server deployment.AuxiliaryArchiverRoledoes 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.
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).
Set WarnWhenFilesWillBeDeleted and NbHoursAheadToWarnThatFilesWillBeDeleted to configure advance warnings before automatic cleanup removes recorded files:
archiver.WarnWhenFilesWillBeDeleted = true;
archiver.NbHoursAheadToWarnThatFilesWillBeDeleted = TimeSpan.FromHours(24);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);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.
- About video: The video hub.
- About cameras: Camera-side recording configuration, manual record, video protection, and stream usage.
- Archive transfer: Backup, retrieve, restore, and trickling between archivers.
- Platform SDK report manager query reference: Archiver event queries and archive transfer history.
- Overview
- Connecting to Security Center
- SDK certificates
- Referencing SDK assemblies
- ASP.NET hosting
- SDK compatibility
- Migrating to modern .NET
- Entities
- Entity cache
- Entity loading, cache, and query options
- Detecting entity changes
- Entity change event reference
- Transactions
- Security Center events
- Actions
- Security Desk
- Custom events
- Event-to-actions
- Managing macros
- ReportManager
- ReportManager query reference
- Access control raw events
- DownloadAllRelatedData and StrictResults
- Privileges
- Partitions
- Entity write restrictions
- About custom fields
- About video
- About cameras
- Enrolling a video unit
- Ingesting third-party video
- Archiver and auxiliary archiver roles
- Archive transfer
- About access control
- About cardholders and credentials
- About doors, areas, elevators, and access points
- About access rules and schedules
- About access control units and interface modules
- Enrolling an access control unit
- Door templates
- Visitors
- Mobile credentials
- About threat levels
- About alarms
- About incidents
- Maps
- Logging
- Overview
- Localization
- Certificates
- Lifecycle
- Threading
- State management
- Configuration
- Restricted configuration
- Events
- Queries
- Request manager
- Database
- Entity ownership
- Engine extensions
- Entity mappings
- Server management
- Custom privileges
- Custom entity types
- Resolving non-SDK assemblies
- Deploying plugins
- Modern .NET support
- Overview
- Localization
- Certificates
- Creating modules
- Tasks
- Pages
- Components
- Tile extensions
- Services
- Contextual actions
- Custom actions
- Options extensions
- Configuration pages
- Monitors
- Shared components
- Commands
- Extending events
- Map extensions
- Timeline providers
- Image extractors
- Credential encoders
- Credential readers
- Cardholder fields extractors
- Badge printers
- Content builders
- Dashboard widgets
- Incidents
- Logon providers
- Pinnable content builders
- Custom report pages
- Overview
- Getting started
- Media file formats
- MediaPlayer
- VideoSourceFilter
- MediaExporter
- MediaFile
- G64 converters
- FileCryptingManager
- PlaybackSequenceQuerier
- PlaybackStreamReader
- OverlayFactory
- PtzCoordinatesManager
- AudioTransmitter
- AudioRecorder
- AnalogMonitorController
- Camera blocking
- Overview
- Getting started
- Referencing entities
- Entity operations
- About access control in the Web SDK
- About video in the Web SDK
- Users and user groups
- Partitions
- Custom fields
- Custom card formats
- Actions
- Events and alarms
- Incidents
- Reports
- Tasks
- Macros
- Custom entity types
- System endpoints
- Performance guide
- Reference
- Endpoints
- Constants
- Enumerations
- Under the hood
- Troubleshooting