示例#1
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     Client = Connect.Client;
     changlanguage();
     threadInvite = new Thread(Invite);                            //实例化线程
     threadShare  = new Thread(new ThreadStart(GetPreview));
     if (captureSource == null)
     {
         // 创建摄像机对象。
         captureSource      = new CaptureSource();
         videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
         // eventhandlers capturesource添加为。
         captureSource.CaptureFailed += new EventHandler <ExceptionRoutedEventArgs>(OnCaptureFailed);
         // 初始化相机如果存在手机上。
         if (videoCaptureDevice != null)
         {
             TheVideoBrush.SetSource(captureSource);
             captureSource.Start();
         }
         else
         {
             MessageBox.Show("您的摄像头设备不支持");
         }
     }
 }
示例#2
0
        private async void StartCameraAsync()
        {
            _cam = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back, AudioVideoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Back).First());

            TheVideoBrush.SetSource(_cam);
        }