我試圖從外部USB攝像頭(C#,Windows 8)捕獲流。以下代碼:從初始化MediaCapture時HRESULT異常:0xC00DABE8
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 0000#{e5323777-f976-4f5b-9b55-b94699c46e44} \ GLOBAL?」)
異常文本:
Exception from HRESULT: 0xC00DABE8
Source "mscorlib"
確定。我試圖做如: S =「System.Exception的:從HRESULT異常:
try
{
mediaCaptureMgr = new MediaCapture();
await mediaCaptureMgr.InitializeAsync();
myCaptureElement.Source = mediaCaptureMgr;
await mediaCaptureMgr.StartPreviewAsync();
}
catch (Exception ee)
{
String s = ee.ToString();
}
就行(mediaCaptureMgr.InitializeAsync()) 在這種情況下會發生錯誤反正0xC00DABE8 \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\ 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「
和異常是相同的:」來自HRESUL的例外T:0xC00DABE8" 當前捕獲源沒有音頻
這意味着要求設置的
MediaCaptureInitializationSettings
視頻或音頻StreamingCaptureMode
」流」。爲什麼你的網絡攝像頭試圖捕捉音頻是不明確的問題。 – 2013-03-15 15:25:52你有沒有嘗試過不同的硬件? – Xyroid 2013-03-22 10:48:29