我正在尝试从外部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);
在最后一行(等待mediaCaptureMgr.InitializeAsync(settings))被触发异常。 变量设置不为空。 设置:
(VideoDeviceId =“\\?\ USB#VID_05E3& PID_0510& MI_00#7& 2D043328& 0&00; 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:来自HRESULT的异常:0xC00DABE8 \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n \ n在System.Runtime.CompilerServices.TaskAwaiter.GetResult()\ r \ n中,在c:\ Users \ Admin \ Documents \ Visual Studio 2012 \ Projects \ TestVideo \ TestVideo \ MainPage中的TestVideo.MainPage.d__0.MoveNext()处。 xaml.cs:第53行“
异常是相同的:“来自HRESULT的异常:0xC00DABE8”
答案 0 :(得分:0)
请根据
等要求将StreamingCaptureMode
的{{1}}设置为视频或音频
MediaCaptureInitializationSettings
我希望这会对你有所帮助