I am creating a Windows Universal application. I want to the user to be able to upload a picture and the user should have the option of taking one on the spot and sending that. I have this working using the MediaCapture api. However I can only seem to use one camera, so for example if my phone has a front and a back camera only the front camera is used. How would I be able to switch the camera that is in use?
I had read something somewhere about using something like this:
private static async Task<DeviceInformation> GetCameraID(Windows.Devices.Enumeration.Panel desired)
{
DeviceInformation deviceID = (await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture))
.FirstOrDefault(x => x.EnclosureLocation != null && x.EnclosureLocation.Panel == desired);
return deviceID;
}
However this always returns null for me, since the deviceID is always null.
Alternatively is there the option of giving control to an application that takes the picture and returns the taken picture to my application? I have found the following, but it doesn't work for Windows Universal apps: http://msdn.microsoft.com/en-us/library/windows/apps/hh394006(v=vs.105).aspx
var devices = (await DeviceInformation.FindAllAsync(DeviceClass.All)).ToList();
, then check what devices are returned? Can you find the cameras there? – Romasz