-
-
Save blackey/2fd1f8e0af69fc825329da2e0f1d1780 to your computer and use it in GitHub Desktop.
Create export with the Pelco VxSdk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Task<VxExport> ExportVideo(VxCamera camera, DateTime startTime, DateTime endTime) | |
{ | |
VxExport export = null; | |
lock (ExportLock) | |
{ | |
if (!IsLoggedIn) return Task.FromResult(export); | |
if (camera == null) return Task.FromResult(export); | |
var newExportClip = new NewExportClip() | |
{ | |
DataEncodingId = "primary", | |
StartTime = startTime, | |
EndTime = endTime, | |
DataSourceId = camera.Id | |
}; | |
var newExport = new NewExport() | |
{ | |
Format = Export.Formats.MkvZip, | |
Name = $"Export {DateTime.Now}" | |
}; | |
newExport.Clips.Add(newExportClip); | |
var vxExport = Run(() => _system.CreateExport(newExport)).RunSync(); | |
while (vxExport != null && (vxExport.Status == Export.States.Pending || vxExport.Status == Export.States.Exporting)) | |
{ | |
Task.Delay(250).RunSync(); | |
Run(() => vxExport.Refresh()).RunSync(); | |
} | |
if (vxExport != null) | |
{ | |
Task.Delay(250).RunSync(); | |
Run(() => vxExport.Refresh()).RunSync(); | |
export = new VxExport(vxExport); | |
} | |
} | |
return Task.FromResult(export); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment