Get live camera snapshot when recording disabled ?

I have a code to get snapshot from recording But how can i get snapshot of live camera when recording disabled But camera is online

 Item item = Configuration.Instance.GetItem(new Guid(id), Kind.Camera);
                JPEGVideoSource jpegVideoSource = new JPEGVideoSource(item);
                jpegVideoSource.Init();
                if (!(jpegVideoSource.GetNearest(DateTime.Now) is JPEGData jpegData))
                {
                    jpegVideoSource.Close();
                    return null;
                }
 
                jpegVideoSource.Close();
                MemoryStream ms = new MemoryStream(jpegData.Bytes);
                Image image;
                image = Image.FromStream(ms);

JPEGVideoSource will only work with recorded footage. Try to use JPEGLiveSource instead. You can see an example using JPEGLiveSource in the CameraStreamResolution sample.

https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/camerastreamresolution/readme.html&tree=tree_2.html