Start the Camera
The RadWebCam control automatically connects to the first camera and recording device it finds. Then it selects the highest available resolution and starts the video.
Disable Auto Start
To disable the automatic start of the camera, set the AutoStart property to False. The default value is True.
Example 1: Disable auto start
<telerik:RadWebCam AutoStart="False"/>
To start the camera at a later moment in time, call the Start method of RadWebCam.
Example 2: Starting the camera
this.radWebCam.Start();
Start Camera Manually
To start the camera manually, select a camera device, video format and recording device, and then call the Initialize method of RadWebCam. The following steps describe how to do this.
- Get the camera devices by calling the RadWebCam.GetVideoCaptureDevices static method.
- Get the video formats supported by the camera device by calling the RadWebCam.GetVideoFormats static methods.
- Initialize the camera control using the collected settings. To do this, call the Initialize method of RadWebCam.
- Start the webcam control by calling the Start method.
Example 3: Starting the camera with manually set device and video format
ReadOnlyCollection<MediaFoundationDeviceInfo> videoDevices = RadWebCam.GetVideoCaptureDevices();
ReadOnlyCollection<MediaFoundationVideoFormatInfo> videoFormats = RadWebCam.GetVideoFormats(videoDevices[0]);
this.radWebCam.Initialize(videoDevices[0], videoFormats[0]);
this.radWebCam.Start();
Example 4: Starting the camera with manually set device, video format and audio format
ReadOnlyCollection<MediaFoundationDeviceInfo> videoDevices = RadWebCam.GetVideoCaptureDevices();
ReadOnlyCollection<MediaFoundationVideoFormatInfo> videoFormats = RadWebCam.GetVideoFormats(videoDevices[0]);
ReadOnlyCollection<MediaFoundationDeviceInfo> recordingDevices = RadWebCam.GetAudioCaptureDevices();
this.radWebCam.Initialize(videoDevices[0], videoFormats[0], recordingDevices[0]);
this.radWebCam.Start();
Read more about the capture devices in the Media Information article.
The manual initialization of RadWebCam should be executed after the control gets loaded. For example, you can use its Loaded event.
Stop the Camera
To stop the camera manually call the Stop method of RadWebCam.
To disconnect from the camera, call the ShutDown method.
Example 5: Stopping the camera
this.radWebCam.Stop();