Siliverlight 4.0视频简单实现

Siliverlight 4.0里面已经支持视频了,实现代码很简单:

 

代码
 1         private void Rectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 2         {
 3             VideoCaptureDevice webcamera = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
 4             if (CaptureDeviceConfiguration.RequestDeviceAccess())
 5             {
 6                 CaptureSource cap = new CaptureSource();
 7                 cap.VideoCaptureDevice = webcamera;
 8                 VideoBrush videoBrush = new VideoBrush();
 9                 videoBrush.SetSource(cap);
10                 videoBrush.Stretch = Stretch.UniformToFill;
11                 cap.Start();
12                 //填充到矩形框中
13                 this.canmera.Fill = videoBrush;
14             }
15         }

 

 

posted @ 2010-01-22 09:54  Raycloud  阅读(393)  评论(1编辑  收藏  举报