2
任何人都可以告訴我,如何使用AudioVideoCaptureDevice錄製視頻,以便在錄製時使用閃光燈開/關。我需要整個代碼的手段.xaml & .xaml.cs類,因爲我在Windows手機開發更新鮮。 目前我使用VideoCaptureDevice進行錄製,但有時會掛起&也不提供Flash。如何使用AudioVideoCaptureDevice錄製視頻
任何人都可以告訴我,如何使用AudioVideoCaptureDevice錄製視頻,以便在錄製時使用閃光燈開/關。我需要整個代碼的手段.xaml & .xaml.cs類,因爲我在Windows手機開發更新鮮。 目前我使用VideoCaptureDevice進行錄製,但有時會掛起&也不提供Flash。如何使用AudioVideoCaptureDevice錄製視頻
我得到了解決,
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);
}