public void DropCameraForView(CaptureElement view) { var viewTag = view.GetTag(); var camera = GetCameraForView(viewTag); if (camera != null) { _cameras.Remove(viewTag); var reactContext = view.GetReactContext(); reactContext.RemoveLifecycleEventListener(camera); } }
public CameraForView GetOrCreateCameraForView(CaptureElement view) { var viewTag = view.GetTag(); var reactContext = view.GetReactContext(); CameraForView result; if (!_cameras.TryGetValue(viewTag, out result)) { result = new CameraForView(view); _cameras.Add(viewTag, result); reactContext.AddLifecycleEventListener(result); } return(result); }