Integrating the Android Camera2 framework
The new Camera2
framework was introduced in API 21 (5.0 Lollipop) and provides a wide featured framework for controlling camera devices connected to any Android device.
Start by setting up the folder structure Renderers | CameraView inside the Camera.Droid
project. Inside the CameraView
folder, add a file called CameraCaptureListener.cs
and implement the following:
public class CameraCaptureListener : CameraCaptureSession.CaptureCallback { public event EventHandler PhotoComplete; public override void OnCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) { PhotoComplete?.Invoke(this, EventArgs.Empty); } }
All we need to do is fire an event every time the OnCaptureCompleted
function is called. This function is called after all the image capture processing is completed.
Next, we have to create a callback for receiving updates...