c# - Windows 8中的摄像头检测

标签 c# windows-8

<分区>

我正在 Windows 8 中开发一个应用程序,它需要摄像头来捕捉图片。所以我需要做的是知道是否存在摄像头(假设桌面没有网络摄像头,而 Windows 8 平板电脑有摄像头),所以我只需要显示控件以在设备上存在摄像头时显示摄像头。

最佳答案

您需要使用此 API: JS:

Windows.Devices.Enumeration.DeviceInformation.findAllAsync(Windows.Devices.Enumeration.DeviceClass.videoCapture).done(yourHandler);

C#:

var interfaces = await DeviceInformation.FindAllAsync(selector, null); 
foreach(DeviceInformation devInfo in interfaces) { /* stuff */ }

This有关于此 API 其他方面的更多信息

由于您使用的是 C#,this样本会更具体。

关于c# - Windows 8中的摄像头检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11846811/

相关文章:

c# - 使用 C++ 填充数组将字节数组从 C# 传递到 C++ com 对象

c# - 将具有多个元素的 XML 反序列化为单个 C# 对象

c# - 如何从 XAML 代码更改 ItemsPanelTemplate WrapGrid?

windows-8 - 不允许在常规桌面应用程序中使用 WinRT API 的 UI 部分的技术原因

c# - Frame.Navigate() 与 this.Frame.Navigate()

windows-8 - VariableSizedWrapGrid 和 WrapGrid child 尺寸测量

c# - VS API 有助于在重构后自动修复代码中断的过程

c# - MVC3 Razor 中显示 2 位十进制值的文本框

c# - 使用 MySQL 创建 edmx "The given key was not present in the dictionary"

windows-8 - 适用于 Windows RT 的数据库