コード例 #1
0
        public void FlipCamera(Action completion)
        {
            if (_captureSession == null)
            {
                return;
            }

            var cameraCell = _getCameraCellFunc.Invoke();

            if (cameraCell == null)
            {
                _captureSession.ChangeCamera(completion);
                return;
            }

            // 1. blur cell
            cameraCell.BlurIfNeeded(true, () =>
            {
                {
                    // 2. flip camera
                    _captureSession.ChangeCamera(() =>
                    {
                        UIView.Transition(cameraCell.PreviewView, 0.25,
                                          UIViewAnimationOptions.TransitionFlipFromLeft | UIViewAnimationOptions.AllowAnimatedContent,
                                          null, () => { cameraCell.UnblurIfNeeded(true, completion); });
                    });
                }
            });
        }