void OnSessionWasInterrupted (NSNotification notification)
{
// In some scenarios we want to enable the user to resume the session running.
// For example, if music playback is initiated via control center while
// using AVMetadataRecordPlay, then the user can let AVMetadataRecordPlay resume
// the session running, which will stop music playback. Note that stopping
// music playback in control center will not automatically resume the session
// running. Also note that it is not always possible to resume
var reasonIntegerValue = ((NSNumber)notification.UserInfo [AVCaptureSession.InterruptionReasonKey]).Int32Value;
var reason = (AVCaptureSessionInterruptionReason)reasonIntegerValue;
Console.WriteLine ($"Capture session was interrupted with reason {reason}");
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;
});
}
}