Silverlight 4: Easy Webcam Overview
- Transfer
Webcam support was the most anticipated innovation and was not new to anyone. It is relatively easy to activate this feature. The following example demonstrates a simple UI with code that connects a webcam. This post does not affect working with multiple webcams, however, by calling CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices , you get a list of all available webcams.
To get started, create a simple UI ( Rectangle and Button ).
Add a button click event. The logic looks something like this:
The next step is to launch the application. You will see a blank screen with a button, after clicking on which, a request window will open to allow the program to use the webcam and microphone. Of course, click "Yes";).
Voila! .. Now you look at yourself, or maybe at the wall or ceiling.
After starting the application, I noticed a mirroring, so that the application displays the image like a mirror, set Flip Rectangl'a on X excise tax. Here's what this menu looks like in Blend:
To get started, create a simple UI ( Rectangle and Button ).
Add a button click event. The logic looks something like this:
- Get the handler of your video capture device using CaptureDeviceConfiguration .
- Request access to the CaptureDeviceConfiguration.RequestDeviceAccess () device .
- If the user has confirmed access, create a CaptureSource object and then set VideoCaptureDevice to the selected webcam.
- Create VideoBrush .
- Set the source of the video brush ( VideoBrush ).
- Launch a webcam.
- Draw a Rectangle (you can use any objects that accept brushes)
The next step is to launch the application. You will see a blank screen with a button, after clicking on which, a request window will open to allow the program to use the webcam and microphone. Of course, click "Yes";).
Voila! .. Now you look at yourself, or maybe at the wall or ceiling.
After starting the application, I noticed a mirroring, so that the application displays the image like a mirror, set Flip Rectangl'a on X excise tax. Here's what this menu looks like in Blend: