简体   繁体   中英

How to access external camera connected to a tablet UWP

I have a external usb camera attached to a tablet which has both front and back camera.

Currently I'm using

var cameraDevice = await FindCameraDeviceByPanelAsync(Windows.Devices.Enumeration.Panel.Back);

To access the back camera, but I would like to access the external usb camera. How can I achieve this?

You should be able to find this device using this

var videoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

Then you can take the ID and pass through the MediaCapture class with the InitializeAsync

MediaCapture m = new MediaCapture();
await m.InitializeAsync(new MediaCaptureInitializationSettings {  VideoDeviceId = videoDevices.First().Id })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM