Ejemplo n.º 1
0
        private void OnRuntimeErrorNotification(NSNotification notification)
        {
            var args = new AVCaptureSessionRuntimeErrorEventArgs(notification);

            if (args.Error != null)
            {
                var error = (AVError)(long)args.Error.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)
                {
                    this.sessionQueue.DispatchAsync(() =>
                    {
                        if (this.isSessionRunning)
                        {
                            this.session.StartRunning();
                            this.isSessionRunning = session.Running;
                        }
                    });
                }
            }
        }
		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;
					}
				});
			}
		}