Getting Started

This tutorial will walk you through the creation of a sample application that contains a RadWebCam.

RadWebCam requires .NET Framework 4.0 and cannot be used with an older version.

Assembly References

In order to use RadWebCam, you will need to add references to the following assemblies:

  • Telerik.WinControls
  • Telerik.WinControls.UI
  • TelerikCommon
  • Telerik.WinControls.RadWebCam
  • Telerik.Windows.MediaFoundation: This dll is located in the UI for WinForms installation folder.
  • MediaFoundation: This dll is located in the UI for WinForms installation folder.

You can download the required assemblies for each control from your Telerik account: Download Product Files.

Setting up the Control

To start using the control you only need to add a RadWebCam control to the form either at design time by dragging it from toolbox and dropping it onto the form or via code.

Adding a RadWebCam at runtime

RadWebCam radWebCam1 = new RadWebCam();
string path = @"..\..\Test images and videos\";
radWebCam1.AutoStart = true;
radWebCam1.RecordingFilePath = path + @"\Video1.mp4";

Dim radWebCam1 As RadWebCam = New RadWebCam()
Dim path As String = "..\..\Test images and videos\"
radWebCam1.AutoStart = True
radWebCam1.RecordingFilePath = path & "\Video1.mp4"

From this point on, you can start using the control without any additional set up.

Auto Start

By default, the camera control will start automatically if a camera device is connected. You can change this by setting the AutoStart property of RadWebCam to false.

radWebCam1.AutoStart = false;

radWebCam1.AutoStart = False

Connect to the Webcam Manually

To connect to the web cam manually you can call the Start method once the control is initialized.



Read more about the capture devices in the Media Information article.

Stop the Camera Control

To stop the stream between the camera device and the RadWebCam control, call the Stop method.



Recording Video

To record a video you need to set RecordingFilePath before start the recording. This is required in order to specify where the recording will be stored on the file system.

To start recording, press the "Start recording" button or call the StartRecording method of RadWebCam. This will start writing the media stream to the corresponding file.

Read more about this in the Recording Video article.

radWebCam1.RecordingFilePath = path + @"\Video1.mp4";

radWebCam1.RecordingFilePath = path + "\Video1.mp4"

Taking Snapshot

A snapshot of the currently displayed video feed can be taken using the TakeSnapshot method of the control, or by pressing the "Take snapshot button". This will fire the SnapshotTaken event where you get access to the current snapshot as an Image object.

private void RadWebCam1_SnapshotTaken(object sender, SnapshotTakenEventArgs e)
    Image snapshot = e.Snapshot;
    // here you save the source to a file, in memory, or to show it in the UI 

Private Sub RadWebCam1_SnapshotTaken(ByVal sender As Object, ByVal e As SnapshotTakenEventArgs)
    Dim snapshot As System.Drawing.Image = e.Snapshot
End Sub

See Also

In this article
Not finding the help you need? Improve this article