Starts the recording of webcam preview to a video file. (Throws a DirectoryNotFoundException if the directory specified in the VideoDirectory property does not exist or if the property is not set).

StopRecording

Stops the recording of webcam preview.

TakeSnapshot

Saves a snapshot of webcam preview. (Throws a DirectoryNotFoundException if the directory specified in the ImageDirectory property does not exist or if the property is not set).

Example

The following example shows how to use the user control. The example contains a Webcam control, two ComboBoxes for displaying video and audio devices, and several buttons for calling the various methods of the user control.

In the code sample the audio and video devices are listed using the EncoderDevices.FindDevices() method. The EncoderDevices class is found in the Microsoft.Expression.Encoder.Devices namespace, so when using the webcam user control in your project ensure that you have installed Expression Encoder and added a reference to Microsoft.Expression.Encoder.dll. You can do this by right-clicking your project, selecting Add Reference from the context menu, and selecting Microsoft.Expression.Encoder in the Assemblies > Extensions section of the Reference Manager dialog box.

NB: When using Microsoft.Expression.Encoder.dll and WebcamControl.dll in your project ensure that the project build platform is set to x86.

To display video from a webcam the user control makes use of the LiveJob class, which is in the Microsoft.Expression.Encoder.Live namespace. LiveJob expose routines for encoding video and audio from a live source such as a webcam. The webcam video is displayed in a WinForms Panel which is hosted in a WindowsFormsHost.

Share

About the Author

Meshack is an avid programmer with a bias towards WPF and VB.NET. He has about 5 years of programming experience initially starting off with Java before shifting to .NET, thanks to the allure of WPF. He currently resides in a small town in Kiambu county, Kenya.

Comments and Discussions

i got same problem,but i am sure no other application is using this webcam.
i also restart my computer,but it still Useless.
The webcam can't use on my PC Since this problem,but can use on other computer.

I am just having a bit of a problem with the StopCapture. The app bombs out every i try click that.
I have tried to apply my on .Dispose() but i think i am a little out of my depth. there is maybe a setting i am missing or some configuration that i might need to tweek?