I'm trying to capture stream from external usb camera (C#, Windows 8). The following code:
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);
In last line (await mediaCaptureMgr.InitializeAsync(settings)) is triggered exception. The variable settings is not null. settings:
(VideoDeviceId ="\\?\USB#VID_05E3&PID_0510&MI_00#7&2D043328&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\GLOBAL")
Exception text:
Exception from HRESULT: 0xC00DABE8
Source "mscorlib"
Ok. I tried to do such as:
try
{
mediaCaptureMgr = new MediaCapture();
await mediaCaptureMgr.InitializeAsync();
myCaptureElement.Source = mediaCaptureMgr;
await mediaCaptureMgr.StartPreviewAsync();
}
catch (Exception ee)
{
String s = ee.ToString();
}
Anyway error occurs on the line (mediaCaptureMgr.InitializeAsync()) In this case: s="System.Exception: Exception from HRESULT: 0xC00DABE8\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n at TestVideo.MainPage.d__0.MoveNext() in c:\Users\Admin\Documents\Visual Studio 2012\Projects\TestVideo\TestVideo\MainPage.xaml.cs:line 53"
And Exception are same:"Exception from HRESULT: 0xC00DABE8"
Please Set StreamingCaptureMode
of MediaCaptureInitializationSettings
to video or audio according to the requirement like
settings.StreamingCaptureMode = settings.StreamingCaptureMode.Video;
I Hope this will help you
User contributions licensed under CC BY-SA 3.0