I want to be able to show the preview of several camera devices using the MediaCapture class.
Currently I initialize the MediaCapture with a MediaCaptureInitializationSettings object which contains the device id. The settings object receives only 1 VideoDeviceId so I cannot set several video sources for the same MediaCapture object. Another thing I tried was to create several MediaCapture objects, one per device. However, it looks like the last one that gets initialized is the one who gets the device access, so even when there are several media devices each one associated to a different device, only the video of one of the devices is allowed to be displayed as a preview.
Below is the code so that you can have a better understanding.
async private void PreviewDevice(string deviceId)
{
var mediaCapture = new MediaCapture();
var mediaCaptureSettings = new MediaCaptureInitializationSettings
{
VideoDeviceId = deviceId
};
await mediaCapture.InitializeAsync(mediaCaptureSettings);
var previewElement = new CaptureElement
{
Source = mediaCapture
};
CamerasDisplayGrid.Children.Add(previewElement);
await mediaCapture.StartPreviewAsync();
}
What I want to achieve is to get the preview of several cameras in the screen at the same time.
Please advice. Thank you in advance
maybe this link can help: http://social.msdn.microsoft.com/Forums/sr-Cyrl-CS/winappswithcsharp/thread/13d2ce8f-de6d-47c0-8992-4d443a49326f