Example #1
0
        public SessionSetupResult ConfigureSession(AVCaptureSession session)
        {
            var inputDeviceConfigureResult = _videoDeviceInputManager.ConfigureVideoDeviceInput(session);

            if (inputDeviceConfigureResult != SessionSetupResult.Success)
            {
                return(inputDeviceConfigureResult);
            }

            // Add movie file output.
            Console.WriteLine("capture session: configuring - adding movie file input");

            var movieFileOutput = new AVCaptureMovieFileOutput();

            if (session.CanAddOutput(movieFileOutput))
            {
                session.AddOutput(movieFileOutput);
                _videoFileOutput = movieFileOutput;

                DispatchQueue.MainQueue.DispatchAsync(() =>
                {
                    _videoRecordingDelegate?.DidBecomeReadyForVideoRecording(this);
                });
            }
            else
            {
                Console.WriteLine("capture session: could not add video output to the session");
                return(SessionSetupResult.ConfigurationFailed);
            }

            _audioCaptureSession = new AudioCaptureSession();
            _audioCaptureSession.ConfigureSession(session);

            return(SessionSetupResult.Success);
        }
Example #2
0
        private void ConfigureLivePhoto(AVCaptureSession session)
        {
            //enable live photos only if we intend to use it explicitly
            if (_presetConfiguration != SessionPresetConfiguration.LivePhotos)
            {
                return;
            }

            _photoOutput.IsLivePhotoCaptureEnabled = _photoOutput.IsLivePhotoCaptureSupported;
            if (_photoOutput.IsLivePhotoCaptureSupported)
            {
                _audioCaptureSession = new AudioCaptureSession();
                _audioCaptureSession.ConfigureSession(session);
            }
            else
            {
                Console.WriteLine(
                    "capture session: configuring - requested live photo mode is not supported by the device");
            }
        }