Closed postacik closed 4 years ago
When I set the option to set the webcam recording to a separate file, the recorded file is just black and empty.
I noticed that the library gives the following exception:
Exception thrown: 'System.InvalidCastException' in Captura.Webcam
...in the following function:
public Bitmap Capture()
{
try
{
return _captureWebcam?.GetFrame();
}
catch { return null; }
}
In the FakesModule you bind CoreWebCamProvider but in the Captura app you bind WebCamProvider.
Should I be doing something similar?
I start recording from the thread of the main form of my application. Can this be the reason?
Utils.MainForm.Invoke(new MethodInvoker(delegate
{
Recorder.StartRecording(windowTitle);
}));
I solved it by changing the following CoreWebCamProvider methods:
public Bitmap Capture()
{
try
{
return (Bitmap)_previewForm.Invoke(new Func<Bitmap>(() => _captureWebcam?.GetFrame()));
}
catch {
return null;
}
}
public int Width => (int)_previewForm.Invoke(new Func<int>(() => _captureWebcam.Size.Width));
public int Height => (int)_previewForm.Invoke(new Func<int>(() => _captureWebcam.Size.Height));
Hi,
I used the Captura.Console sample as a base application and created a Winforms application with Captura libraries.
When I run the Captura.Console app with "--webcam 1" option, it can capture the webcam without any problems.
But when I do the same in my Winforms application with the following lines, webcam is not recorded.
Do you have any idea why this may happen?
The Webcam library always creates a preview window when SelectedCam is set.
In your app there's always a tiny window at the top which shows the webcam view when a webcam is selected.
Should I do the same in my Winforms application?