AVCamManual.AVCamManualCameraViewController.SessionWasInterrupted C# (CSharp) Метод

SessionWasInterrupted() приватный Метод

private SessionWasInterrupted ( NSNotification notification ) : void
notification NSNotification
Результат void
		void SessionWasInterrupted (NSNotification notification)
		{
			// In some scenarios we want to enable the user to restart the capture session.
			// For example, if music playback is initiated via Control Center while using AVCamManual,
			// then the user can let AVCamManual resume the session running, which will stop music playback.
			// Note that stopping music playback in Control Center will not automatically resume the session.
			// Also note that it is not always possible to resume, see ResumeInterruptedSession method.
			// In iOS 9 and later, the notification's UserInfo dictionary contains information about why the session was interrupted
			var reason = (AVCaptureSessionInterruptionReason)notification.UserInfo [AVCaptureSession.InterruptionReasonKey].AsInt ();
			Console.WriteLine ($"Capture session was interrupted with reason {reason}");

			if (reason == AVCaptureSessionInterruptionReason.AudioDeviceInUseByAnotherClient ||
				reason == AVCaptureSessionInterruptionReason.VideoDeviceInUseByAnotherClient) {
				// Simply fade-in a button to enable the user to try to resume the session running
				ResumeButton.Hidden = false;
				ResumeButton.Alpha = 0;
				UIView.Animate (0.25, () => ResumeButton.Alpha = 1);
			} else if (reason == AVCaptureSessionInterruptionReason.VideoDeviceNotAvailableWithMultipleForegroundApps) {
				// Simply fade-in a label to inform the user that the camera is unavailable
				CameraUnavailableLabel.Hidden = false;
				CameraUnavailableLabel.Alpha = 0;
				UIView.Animate (0.25, () => CameraUnavailableLabel.Alpha = 1);
			}
		}