AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

How to use VideoSourceError

The forum is to discuss topics related to different areas of image processing and computer vision.

How to use VideoSourceError

Postby JTALATALA » Wed Apr 24, 2019 4:02 am

I want to stop the VideoSource when there is an error to prevent application from hanging.
How can i use the VideoSourceError to do that.

this is what i have so far and it's not working.

FinalVideoSource = new VideoCaptureDevice(camMoniker);
FinalVideoSource.NewFrame += FinalVideoSource_NewFrame;
FinalVideoSource.VideoSourceError += FinalVideoSource_VideoSourceError;
FinalVideoSource.Start();

private void FinalVideoSource_VideoSourceError(object sender, VideoSourceErrorEventArgs eventArgs)
{
FinalVideoSource.Stop();
FinalVideoSource.SignalToStop();
}
JTALATALA
 
Posts: 1
Joined: Wed Apr 24, 2019 3:58 am

Re: How to use VideoSourceError

Postby andrew.kirillov » Wed Apr 24, 2019 8:57 am

JTALATALA wrote:I want to stop the VideoSource when there is an error to prevent application from hanging.

Application should not really hang in case of errors comming from video source. Yes, video will not come. But nothing will hang either. If it does happen, then something else is done wrong.

JTALATALA wrote:this is what i have so far and it's not working.

What exactly does not work? Don't put Stop() there, just SignalToStop().
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3446
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to Image Processing and Computer Vision