In last month I’ve managed to show the camera stream in my mockup (using directX video player), now that we’ve given the software to the customer he tried with a real camera and asked us to allow to specify the video channel that the camera exposes (320p, 1024p and so on.
I was wondering how do I get it when asking for the camera stream… is this possible? How?
I get the camera via
imageViewerWpfControl = this.GetUIElement();
imageViewerWpfControl.LiveStreamInformationReceived += ImageViewerWpfControl\_LiveStreamInformationReceived;
Log.Debug($"Control imageviewer is null : {imageViewerWpfControl == null}");
if (imageViewerWpfControl != null)
{
Log.Debug("Disconnecting");
imageViewerWpfControl.Disconnect();
Log.Debug($"CameraFQID '{cameraItem.FQID}'");
imageViewerWpfControl.CameraFQID = cameraItem.FQID;
Log.Debug("Initialize");
imageViewerWpfControl.Initialize();
Log.Debug("Connecting");
imageViewerWpfControl.Connect();
Log.Debug("Connected");
}
and here’s the method I use to lookup for a camera
public Task GetItemFromNameAsync(string cameraName)
{
return Task.Factory.StartNew(() =>
{
var items = VideoOS.Platform.Configuration.Instance.GetItemsBySearch(cameraName, 1, CameraConnectionTimeout, out var result);
Log.Debug($"Camera search result for {cameraName}:{result}");
if (result == SearchResult.OK)
{
return items.SingleOrDefault();
}
else
{
return null;
}
});
}
Thanks
When you setup your cameras in the Management Client you setup the resolution they will be streaming. This is the resolution the ImageViewerWpfControl will get.
You have the option to set up the camera so that multiple streams with different resolutions can be used. Please refer to the Management Client help or the Administrators Manual on how to set it up.
When you have a camera with multiple live streams you will be able to choose the stream to use in the ImageViewerWpfControl. On how to find the streams and do the choosing I would like to recommend the PlaybackWpfUser sample, notice how in live mode the drop down next to the camera drop down will be populated and can be used to choose stream.
http://doc.developer.milestonesys.com/html/index.html?base=samples/playbackwpfuser.html&tree=tree_2.html
If you would like to probe the different streams for their resolution the Camera Stream Resolution sample can be used as inspiration.
http://doc.developer.milestonesys.com/html/index.html?base=samples/camerastreamresolution.html&tree=tree_2.html
Hello,
I’ve tried my code and also the playbackwpfsample…when I try to access at the information contained on a real camera (BOSCH FLEXIDOME IP micro 5000 MP)
it hangs…the strange thing is that the name of the camera is correcly passed to the method
var items = VideoOS.Platform.Configuration.Instance.GetItemsBySearch(cameraName, 1, CameraConnectionTimeout, out var result);
[Log.Info](https://Log.Info)($"Found {items.Count} corresponding for name {cameraName}");
var item = items.FirstOrDefault();
Log.Debug($"Camera search result for {cameraName}:{result}");
if (result == SearchResult.OK || item != null)
{
return item;
}
else
{
Log.Error($"Returning null for camera {cameraName}");
return null;
}
but it’s returning null.. for direct show camera it was working instead
I think your code might fail because it finds too many items. (Result CountExceeded.) You might have “BOSCH FLEXIDOME IP micro 5000 MP - Input”, “BOSCH FLEXIDOME IP micro 5000 MP - Output” etc. This is because GetItemsBySearch does not limit itself to camera items. For a better view of what you get try to test with this snippet of code:
private void button1_Click(object sender, EventArgs e)
{
label2.Text = "The result is" + Environment.NewLine + "This" + Environment.NewLine;
var items = VideoOS.Platform.Configuration.Instance.GetItemsBySearch(textBox1.Text, 100, 60, out var result);
label2.Text += result.ToString() + Environment.NewLine;
label2.Text += "Number of items " + items.Count + Environment.NewLine;
foreach(var item in items)
{
label2.Text += item.Name +" -with FQID: "+ item.FQID.ToString() + Environment.NewLine;
}
}
If this does not directly lead you to solve the issue please show me what you get if using my snippet to test with.
This last question has nothing or very little to do with the first question, for the usability of the forum please ask new questions in new threads on the forum.
This evening I’ll give a try, please excuse me if I have not open a new thread
Thanks