我正在尝试从外部 USB 摄像头(C#,Windows 8)捕获流。以下代码:
DeviceInformationCollection devInfoCollection = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
MediaCaptureInitializationSettings settings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
settings.VideoDeviceId = devInfoCollection[0].Id;
mediaCaptureMgr = new MediaCapture();
await mediaCaptureMgr.InitializeAsync(settings);
在最后一行 (await mediaCaptureMgr.InitializeAsync(settings)) 被触发异常。变量设置不为空。设置:
(VideoDeviceId ="\\?\USB#VID_05E3&PID_0510&MI_00#7&2D043328&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\GLOBAL")
异常文本:
Exception from HRESULT: 0xC00DABE8
Source "mscorlib"
好的。我试图这样做:
try
{
mediaCaptureMgr = new MediaCapture();
await mediaCaptureMgr.InitializeAsync();
myCaptureElement.Source = mediaCaptureMgr;
await mediaCaptureMgr.StartPreviewAsync();
}
catch (Exception ee)
{
String s = ee.ToString();
}
无论如何,在线上发生错误 (mediaCaptureMgr.InitializeAsync()) 在这种情况下:s="System.Exception: Exception from HRESULT: 0xC00DABE8\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\ n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n 在 TestVideo.MainPage.d__0.MoveNext() 在 c:\Users \Admin\Documents\Visual Studio 2012\Projects\TestVideo\TestVideo\MainPage.xaml.cs:line 53"
异常相同:“HRESULT 异常:0xC00DABE8”