I’m trying the following: my app will receive a command to get a snapshot from a camera at a past moment from another app. I successfully logged in, listed the cameras, as in:
var configs = Configuration.Instance.GetItems();
foreach (var config in configs) {
foreach (var cameraGroup in config.GetChildren()) {
foreach (var defaultCameraGroup in cameraGroup.GetChildren()) {
foreach (var camera in defaultCameraGroup.GetChildren()) {
if (camera.FQID.Kind == Kind.Camera) {
Cameras[camera.FQID.ObjectId] = camera;
var status = 0;
var jpegSource = new JPEGVideoSource(camera);
try {
jpegSource.Init();
var jpegData = jpegSource.GetAtOrBefore(new DateTime()) as JPEGData;
File.WriteAllBytes($"C:/Snapshots/{camera.Name}.jpg", jpegData.Bytes);
} catch (Exception e) {
Console.WriteLine(e.Message);
status = 1;
}
LstCameras.Items.Add(camera.Name, status);
}
}
}
}
}
But at the line “jpegSource.Init()” it crashes with “Unable to connect to Toolkit” error.
I’ve read a couple of threads about it:
https://supportcommunity.milestonesys.com/s/question/0D50O000049u3cpSAA/unable-to-connect-to-toolkit
https://developer.milestonesys.com/s/question/0D50O00003NHiu8SAD/unable-to-connect-to-toolkit
But neither helped. Tried restarting the server, my PC. Both firewalls are disabled and I can connect to the server fine.
I also tried the MediaLiveViewer from the samples, but it also cannot connect.
Can someone help me with this?