05/12/2014 by Nitesh

How To Get Access to Front & Back Camera in Windows 8.1 Store App

Friends,

In this post, we will see how can we get access specifically to Front camera/Back camera in our Windows 8/8.1 Store App. To get the access, we will use DeviceInformation class defined in Windows.Devices.Enumeration namespace. Below is the code snippet for the same –

DeviceInformationCollection webcamList = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

DeviceInformation frontWebcam = (from webcam in webcamList
                                            where webcam.EnclosureLocation != null
                                            && webcam.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Front
                                            select webcam).FirstOrDefault();

DeviceInformation backWebcam = (from webcam in webcamList
                                            where webcam.EnclosureLocation != null
                                            && webcam.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Back
                                            select webcam).FirstOrDefault();

Hope you like this. Keep learning and sharing! Cheers!

#How To?#windows store 8 apps#windows8