感觉这种方法获取摄像头列表名称,比较方便
using System.Management;
private static void GetUSBDevices()
{
var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE (PNPClass = 'Image' OR PNPClass = 'Camera')");
foreach (var device in searcher.Get())
{
Debug.WriteLine($"Device: {device["PNPClass"]} / {device["Caption"]}");
}
}