Page 1 of 1

WebCAm not starting

PostPosted: Tue Mar 17, 2015 4:29 pm
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.

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