如何使用音频视频捕获设备录制视频

时间:2013-12-10 10:28:10

标签: windows-phone-8 video-capture video-recording

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

1 个答案:

答案 0 :(得分: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);
            }