Silverlight4beta brings a new and long-awaited feature: support for the camera/microphone.
This article will demonstrate this new feature through an example of the operation of the camera, and our example mainly implements the following features
Display device Name
Start/Stop capturing video
Real-time Image capture
Because the microphone is used in the same way as the camera, and can not be intuitive performance so here is not to repeat.
As usual, let's start with a simple UI, and the XAML
<UserControl.Resources>
<style targettype= "TextBlock" >
<setter property= "fontsize" value= "/>"
<setter property= "FontFamily" value= "Arial,simsun"/>
</Style>
<style targettype= "button" >
<setter property= "fontsize" value= "/>"
<setter property= "FontFamily" value= "SimSun"/>
<setter property= "Margin" value= "5"/>
</Style>
</UserControl.Resources>
<stackpanel x:name= "LayoutRoot" width= ">"
<TextBlock>
<run text= "Video device name:"/>
<run x:name= "Txtcameraname"/>
</TextBlock>
<border borderbrush= "Black" borderthickness= "2" width= "height=" >
<rectangle x:name= "Container" >
</Rectangle>
</Border>
<stackpanel orientation= "Horizontal" >
<button content= "Start" x:name= "Btnstart"/>
<button content= "Stop" x:name= "Btnstop"/>
<button content= "screenshots" x:name= "Btncapture"/>
</StackPanel>
<image x:name= "Imgcapture" width= "height=" "/>"
</StackPanel>