Reputation: 79
I'm currently putting together a little project in c# designed to be used on Windows based tablets.
I have integrated the open source code available from http://easywebcam.codeplex.com/ to run the tablets camera. However, when you click the start button, it asks you to choose between the front or rear camera and as it is being used on a touch screen tablet, it's a bit on the fiddly side.
Does anyone know of a way of either adding a button to choose between the cameras or, better still, a way of automatically selecting the rear camera?
Upvotes: 0
Views: 1832
Reputation: 15271
For Windows Store apps, a list of video capture device ids can be returned from DeviceInformation.FindAllAsync(DeviceClass.VideoCapture). See the Device enumeration sample for details.
Then you can set MediaCaptureInitializationSettings.VideoDeviceId and use it to initialize a capture session. Note however, this only supports UI-less capture. You cannot customize the selection in the CameraCaptureUI dialog.
For Desktop apps, a list of video capture device monikers can be returned from the device numerator (see How To Get A List Of Available Video Capture Devices for an example). Then you can plug the desired device moniker in your filter graph via IFilterGraph::AddFilter.
Upvotes: 1