Issue in getting snapshot of the camera for a given time.

Item item = Configuration.Instance.GetItem(new Guid(cameraId), Kind.Camera);
                JPEGVideoSource jpegVideoSource = new JPEGVideoSource(item);
                jpegVideoSource.Compression = ImageQuality;
                jpegVideoSource.Init();
                if (!(jpegVideoSource.Get(dateTime) is JPEGData jpegData))
                {
                    jpegVideoSource.Close();
                    return null;
                }
 
                jpegVideoSource.Close();

Using above code to get snapshot

This code uses jpegVideoSource.Get() , but even if the recording is not present instead of returning null it returns an object.

We get the nearest image i think

But i need snapshot if recording is present at that time otherwise empty or null

please help

The behavior is always to return a picture, it will search backwards and return the “newest” image, and that might be milliseconds old or a very large time-span. This behavior is core design and cannot be easily changed. I suggest you add a routine to check the JPEGData.DateTime and validate if the image you get is too old (compare to the time you asked for).