void SessionRuntimeError (NSNotification notification)
{
var error = (NSError)notification.UserInfo [AVCaptureSession.ErrorKey];
if (error == null)
return;
Console.WriteLine ($"Capture session runtime error: {error.LocalizedDescription}");
// Automatically try to restart the session running if media services were reset and the last start running succeeded.
// Otherwise, enable the user to try to resume the session running.
if (error.Code == (int)AVError.MediaServicesWereReset) {
sessionQueue.DispatchAsync (() => {
if (sessionRunning) {
session.StartRunning ();
sessionRunning = session.Running;
} else {
DispatchQueue.MainQueue.DispatchAsync (() => ResumeButton.Hidden = false);
}
});
} else {
ResumeButton.Hidden = false;
}
}