Question

Can anyone tell me, how to record video using AudioVideoCaptureDevice so that I can use flash ON/OFF, while recording. I need the whole code means .xaml & .xaml.cs class as I am fresher in Windows phone Development. Presently I used VideoCaptureDevice to record but it is sometime hangs & also doesn't provide flash.

Was it helpful?

Solution

I got the solution,

 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);
            }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top