O'Reilly logo

.NET Framework 4.5 Expert Programming Cookbook by A.P. Rajshekhar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing webcams

In certain scenarios, you may have to access the webcam of the client. From Silverlight 4 onwards, the API to access webcams have become simpler to use. In this recipe, we will see how to use webcams to display live images.

How to do it...

  1. Launch Visual Studio 2012. Create a new project of the type Silverlight Application. Name it WebCam.
  2. Open MainPage.xaml. Add the following code to the <Grid> section:
    <Rectangle RadiusX="5" RadiusY="5" x:Name="rectCam" Height="285" HorizontalAlignment="Left" Margin="10,10,0,0" Stroke="Black" StrokeThickness="1" VerticalAlignment="Top" Width="383" Fill="Black" /> <Button Content="Start Webcam" Height="23" HorizontalAlignment="Left" Margin="68,330,0,0" Name="btnStart" VerticalAlignment="Top" Width="94"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required