Hi,
I am using Milestone MIP SDK 26.1.2 in a .NET Framework application, and I am facing a delay when initially fetching the camera item during the first connection to a Milestone Server.
My current login/configuration flow is:
Environment.Initialize();
Environment.AddServer(…);
Environment.Login(…);
Environment.LoadConfiguration(serverUri);
Configuration.Instance.GetItemsByKind(Kind.Server); // Takes around 20 seconds on first call
VideoOS.Platform.Configuration.Instance.GetItem(cameraGuid, Kind.Camera);
Environment.Login() and Environment.LoadConfiguration() both complete successfully within a few seconds.
However, after the SDK login is succeeded, the first call to:
Configuration.Instance.GetItemsByKind(Kind.Server);
takes approximately 20 seconds to complete.
Additionally, this delay varies depending on the Milestone Server. For example, on other Milestone Server the same first call takes around 8 seconds, while on others it takes 20 seconds.
It is also noticed that:
Configuration.Instance.GetItem(cameraGuid, Kind.Camera);
can retrieve the camera only after Configuration.Instance.GetItemsByKind(Kind.Server) has completed. Before that first GetItemsByKind(Kind.Server) call finishes, GetItem(cameraGuid, Kind.Camera) does not return the camera item. Once GetItemsByKind(Kind.Server) completes after the 20-second delay, the camera item becomes available immediately.
After this initial call completes:
-
Camera configuration can be retrieved successfully.
-
Live streaming works correctly.
-
Subsequent calls to GetItemsByKind(Kind.Server) completed very quickly.
It is also observed that if the application first connects to another Milestone server, for example Milestone server B, and then connects to Milestone server A within the same application process, there is no delay when calling GetItemsByKind(Kind.Server) for Milestone server A.
So the delay appears to happen only on the first connection after the application starts.
Could you please clarify the following?
-
Why does Configuration.Instance.GetItem(cameraGuid, Kind.Camera) appear to depend on Configuration.Instance.GetItemsByKind(Kind.Server) before the camera item can be retrieved?
-
Is there a recommended way to warm up or preload the SDK after login so this initial delay can be avoided?
-
Is there another SDK API that performs the required initialization more efficiently than calling Configuration.Instance.GetItemsByKind(Kind.Server)?
This delay causes the first live stream to load very slowly, taking more than 20 seconds, because the live stream can only be started after the camera item has been retrieved.
Any guidance or recommended best practice would be greatly appreciated.
Thank you.