void OnRuntimeErrorNotification (NSNotification notification)
{
var e = new AVCaptureSessionRuntimeErrorEventArgs (notification);
var errorVal = e.Error;
if (errorVal == null)
return;
var error = (AVError)(long)errorVal.Code;
Console.WriteLine ($"Capture session runtime error: {error}");
// 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 == AVError.MediaServicesWereReset) {
sessionQueue.DispatchAsync (() => {
if (sessionRunning) {
session.StartRunning ();
sessionRunning = session.Running;
}
});
}
}