Beispiel #1
0
        private void AddObservers()
        {
            _runningObserver = _session.AddObserver("running", NSKeyValueObservingOptions.New, OnSessionRunningChangedHandler);

            if (_stillImageOutput != null)
            {
                _capturingStillObserver = _stillImageOutput.AddObserver("capturingStillImage", NSKeyValueObservingOptions.New, OnCapturingStillImageChangedHandler);
            }

            _recordingObserver = _movieFileOutput.AddObserver("recording", NSKeyValueObservingOptions.New, OnRecordingChangedHandler);


            _subjectSubscriber    = NSNotificationCenter.DefaultCenter.AddObserver(AVCaptureDevice.SubjectAreaDidChangeNotification, OnSubjectAreaChangedHandler, _videoDeviceInput.Device);
            _runtimeErrorObserver = NSNotificationCenter.DefaultCenter.AddObserver(AVCaptureSession.RuntimeErrorNotification, OnSessionRuntimeErrorOccuredHandler, _session);

            // A session can only run when the app is full screen. It will be interrupted in a multi-app layout, introduced in iOS 9.
            // Add observers to handle these session interruptions
            // and show a preview is paused message. See the documentation of AVCaptureSession.WasInterruptedNotification for other
            // interruption reasons.
            _interuptionObserver      = NSNotificationCenter.DefaultCenter.AddObserver(AVCaptureSession.WasInterruptedNotification, OnSessionWasInterruptedHandler, _session);
            _interuptionEndedObserver = NSNotificationCenter.DefaultCenter.AddObserver(AVCaptureSession.InterruptionEndedNotification, OnSessionInterruptionEndedHandler, _session);
        }