public static FocusHandler Create(CameraDeviceAndroid receiver) { var handler = new GameObject("NatCam Focus Handler").AddComponent <FocusHandler>(); handler.receiver = receiver; handler.startCallback = receiver.callback.startCallback; handler.frameCallback = receiver.callback.frameCallback; return(handler); }
public new static CameraDeviceAndroid[] GetDevices() { CameraDevice = CameraDevice ?? new AndroidJavaClass(@"com.olokobayusuf.natcam.CameraDevice"); Unmanaged = Unmanaged ?? new AndroidJavaClass(@"com.olokobayusuf.natrender.Unmanaged"); try { using (var devicesArray = CameraDevice.CallStatic <AndroidJavaObject>(@"getDevices")) { var devices = AndroidJNIHelper.ConvertFromJNIArray <AndroidJavaObject[]>(devicesArray.GetRawObject()); var result = new CameraDeviceAndroid[devices.Length]; for (var i = 0; i < devices.Length; i++) { result[i] = new CameraDeviceAndroid(devices[i]); } return(result); } } catch (Exception) { // Permissions denied return(null); } }