Exemplo n.º 1
0
        void AddObservers()
        {
            runningObserver = session.AddObserver("running", NSKeyValueObservingOptions.New, OnSessionRunningChanged);

            subjectSubscriber    = NSNotificationCenter.DefaultCenter.AddObserver(AVCaptureDevice.SubjectAreaDidChangeNotification, SubjectAreaDidChange, videoDeviceInput.Device);
            runtimeErrorObserver = NSNotificationCenter.DefaultCenter.AddObserver(AVCaptureSession.RuntimeErrorNotification, SessionRuntimeError, 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, SessionWasInterrupted, session);
            interuptionEndedObserver = NSNotificationCenter.DefaultCenter.AddObserver(AVCaptureSession.InterruptionEndedNotification, SessionInterruptionEnded, session);
        }
Exemplo n.º 2
0
        public void AddObservers(AVCaptureSession session)
        {
            if (_addedObservers)
            {
                return;
            }

            session.AddObserver(this, RunningObserverKeyPath, NSKeyValueObservingOptions.New, _sessionRunningObserveContext);

            _wasInterruptedNotification = NSNotificationCenter.DefaultCenter.AddObserver(
                AVCaptureSession.WasInterruptedNotification,
                SessionWasInterrupted, session);
            _interruptionEndedNotification = NSNotificationCenter.DefaultCenter.AddObserver(
                AVCaptureSession.InterruptionEndedNotification,
                SessionInterruptionEnded, session);

            _addedObservers = true;
        }
Exemplo n.º 3
0
        void AddObservers()
        {
            runningChangeToken = session.AddObserver("running", NSKeyValueObservingOptions.New, RunningChanged);

            // Observe the previewView's regionOfInterest to update the AVCaptureMetadataOutput's
            // RectOfInterest when the user finishes resizing the region of interest.
            PreviewView.RegionOfInterestDidChange += RegionOfInterestChanged;

            var center = NSNotificationCenter.DefaultCenter;

            runtimeErrorNotificationToken = center.AddObserver(AVCaptureSession.RuntimeErrorNotification, OnRuntimeErrorNotification, 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, see also the documentation of
            // AVCaptureSessionInterruptionReason.Add observers to handle these session
            // interruptions and show a preview is paused message.See the documentation
            // of AVCaptureSessionWasInterruptedNotification for other interruption reasons.
            wasInterruptedNotificationToken    = center.AddObserver(AVCaptureSession.WasInterruptedNotification, OnSessionWasInterrupted, session);
            interruptionEndedNotificationToken = center.AddObserver(AVCaptureSession.InterruptionEndedNotification, OnSessionInterruptionEnded, session);
        }
Exemplo n.º 4
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);
        }