2013-12-10 48 views
2

任何人都可以告诉我,如何使用AudioVideoCaptureDevice录制视频,以便在录制时使用闪光灯开/关。我需要整个代码的手段.xaml & .xaml.cs类,因为我在Windows手机开发更新鲜。 目前我使用VideoCaptureDevice进行录制,但有时会挂起&也不提供Flash。如何使用AudioVideoCaptureDevice录制视频

回答

1

我得到了解决,

videoCaptureDevice = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back, AudioVideoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Back).First()); 

      videoCaptureDevice.SetProperty(KnownCameraAudioVideoProperties.VideoTorchMode, VideoTorchMode.On); 


      // Initialize the camera if it exists on the device. 
      try 
      { 
       if (videoCaptureDevice != null) 
       { 
        //// Create the VideoBrush for the viewfinder. 
        videoRecorderBrush = new VideoBrush(); 
        videoRecorderBrush.SetSource(videoCaptureDevice); 

        //// Display the viewfinder image on the rectangle. 
        viewfinderRectangle.Fill = videoRecorderBrush; 

        // Set the button state and the message. 
        UpdateUI(ButtonState.Initialized, "Tap record to start recording..."); 
       } 
       else 
       { 
        // Disable buttons when the camera is not supported by the device. 
        UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this device."); 
       } 
      } 
      catch(Exception ex) 
      { 
       MessageBox.Show("exception "+ex); 
      }