Page 1 of 1

Webcam not capturing image in Win8

PostPosted: Mon Jun 01, 2015 10:17 am
by dhelawat
Hello,

I am using windows 8 in laptop and my application is using Aforge for webcam in my application.But now problem is one front camera is working fine but back camera not starting when I switch the camera. I have lenova thinkpad.

Even i tried simple player to see whether that is working or not and that even doesnt work. Please help!!

Default webcam app of tablet is working fine.

Can you help me with the issue.

Using below code:

private void OnStartVideo()
{
CameraNotInitialized = _videoDevices.Count == 0;

if (CameraNotInitialized)
return;

_videoSource = new VideoCaptureDevice(_videoDevices[_activeDeviceIndex].MonikerString);

_videoSource.NewFrame += VideoNewFrame;
_videoSource.Start();

StopCamera.RaiseCanExecuteChanged();
}

private void OnSwitchCamera()
{
if (_videoDevices.Count > 1)
{
_activeDeviceIndex = _activeDeviceIndex == 0 ? 1 : 0;
}
else
_activeDeviceIndex = 0;

if (_videoSource == null) return;

if (_videoSource.IsRunning)
_videoSource.Stop();

UserSettings.DefaultCameraIndex = _activeDeviceIndex;
UserSettings.Save();

OnStartVideo();
}

Thanks
Anand