Completed
Last Updated: 13 Aug 2021 12:44 by ADMIN
Release LIB 2021.2.816 (16 Aug 2021)
Xavier
Created on: 11 Aug 2021 09:03
Category: WebCam
Type: Bug Report
0
RadWebCam unhandled exception

a call to StartRecording() results in an unhandled null reference exception when the webcam has been disabled. (this is not the case when other webcam errors occur, like when the webcam is taken by another application). 

Our application provides a fallback scenario to make an audio recording when the webcam is not available, in order for this to work it would be preferable to be able to call the StartRecording() method without causing a crash, and to still have the RecordingStarted event triggered, just like in the case of a "camera unavailable" error.

 

3 comments
ADMIN
Ivan Petrov
Posted on: 12 Aug 2021 14:12

I am glad this works for you, Xavier.

Regards,
Ivan Petrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Xavier
Posted on: 12 Aug 2021 12:54
Thanks for the answer, Ivan. Your suggestion indeed is the solution, this way the same code can be used for different edge cases like trying to access a blocked or disabled webcam.
ADMIN
Ivan Petrov
Posted on: 12 Aug 2021 10:07

Hi Xavier,

I can confirm the discrepancy in the behavior in these two cases.

As a workaround I can suggest you check the RadWebCam's HasError property inside the StartRecording event handler and setting the Cancel property of the event arguments to true if there is an error. This will prevent the execution of the code that throws the exception. Here is a code snippet:

private void Camera_RecordingStarted(object sender, RecordingStartedEventArgs e)
{
	if (this.camera.HasError)
	{
		e.Cancel = true;
	}
}

Regards,
Ivan Petrov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.