This is a mirror of official site: http://jasper-net.blogspot.com/

Webcam Support in Silverlight 4 to capture Video

| Monday, April 11, 2011
Silverlight 4 support for audio capture devices and video capture devices (Webcam), has opened up a new range of possibilities like audio/video recording, snapshots etc. You can also use the Webcam feature for Video conferencing but since there is limited support for compression and encoding available out-of-the-box, it is not yet a very viable solution for conferencing. In this short article, we will see how simple it is to use a Webcam in Silverlight 4.

Silverlight automatically recognizes the video and audio capture devices on your machine. If you want to explicitly list the audio and video devices for the end user to choose from, read my blogpost Silverlight 4: List Audio and Video Devices

Follow these steps:

Step 1: Create a new Silverlight 4 application and call it ‘SilverlightWebCam’.

Step 2: In the MainPage.xaml, add the following controls:

silverlight-webcam-layout.png

Step 3: In the code behind, create a CaptureSource object as a member field, so that it is available for all events. The CaptureSource class is an important class that provides methods that work with specific audio or video captures from the associated capture device.

private CaptureSource _cs = null;

Now create the event handlers for the Start and Stop button

silverlight-webcam-startstop.png

Step 4: In the btnStartWebcam event handler, we are making a call to the StartWebCam() method. Let us code this method, as shown below:

silverlight-webcam-start.png

Read more: net Curry

Posted via email from Jasper-net

0 comments: