We have made a Windows Service which listens for LPR events.
When a license is flagged a snapshot is requested from the recording server.
The snapshot we get from the recording server always differs from the image we lookup in Smart Client.
The difference in time is between 500ms to 15 secs.
We have tried everything, but can’t get this correct.
Is there a log somewhere in Milestone which logs the SDK requests? So we can check if the timestamp in the request matches with the snapshot?
Or does someone know why the time differs?
The following code snippet is a form that show the picture from recording using the information in the analytics event. This works for me in all my testing.
public partial class FormShow : Form
{
private AnalyticsEvent _analyticsEvent;
public FormShow(AnalyticsEvent analyticsEvent)
{
InitializeComponent();
_analyticsEvent = analyticsEvent;
}
private void FormShow_Load(object sender, EventArgs e)
{
EventSource eventSource = _analyticsEvent.EventHeader.Source;
Item eventItem = Configuration.Instance.GetItem(eventSource.FQID);
DateTime eventtime = _analyticsEvent.EventHeader.Timestamp;
label1.Text = eventtime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff");
JPEGVideoSource jpegVideoSource = new JPEGVideoSource(eventItem);
jpegVideoSource.Init(pictureBox.Width,pictureBox.Height);
JPEGData jpegData = jpegVideoSource.GetAtOrBefore(eventtime) as JPEGData;
MemoryStream ms = new MemoryStream(jpegData.Bytes);
Bitmap newBitmap = new Bitmap(ms);
if (newBitmap.Width != pictureBox.Width || newBitmap.Height != pictureBox.Height)
{
pictureBox.Image = new Bitmap(newBitmap, pictureBox.Size);
}
else
{
pictureBox.Image = newBitmap;
}
ms.Close();
ms.Dispose();
label2.Text = jpegData.DateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff");
}
}