New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms WebCam

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.

Microsoft Media Foundation enables the development of applications and components for using digital media on Windows Vista and later. Thus, RadWebCam is not support for Windows XP machines. Also, the lastest version of Windows 7, Service Pack 1 (6.1.7601.24499), doesn't support RadWebCam as well.

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.

RadWebCam video recording relies on USB web cams being able to use MJPEG or H264 encoded streams. On August 2nd, 2016, Microsoft released the Anniversary Update for Windows 10 (1607) which has broken millions of Web cams. In this update Windows no longer allowed USB web cams to use MJPEG or H264 encoded streams and was only allowing YUY2 encoding. According to a comment in this discussion the bug was fixed in April 2017 (version 1703, 10.0.15063).

Adding a RadWebCam at runtime


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


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

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 = Falses

Connect to the Webcam Manually

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


        radWebCam1.Start();


        radWebCam1.Start()

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.


        radWebCam1.Stop();


        radWebCam1.Stop()

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

Telerik UI for WinForms Learning Resources

In this article