When we introduced support for z-ordering of peer components in Codename One we listed two major targets. The first was already available: Map. The second was still pending: Camera.
Capture API is very high level and removes a lot of the control from the developer. In order to give developers a high level of control we created Camera Kit.
Camera Kit is based on a native Android Camera Kit project whose API we used to implement the Android port and for inspiration. This new API works on Android & iOS at this time. It allows you to grab photos/videos & view the camera preview like you would any other media.
You can overlay your Codename One widgets on top of the camera view as you can see in the project sample and screenshot.
This effectively makes a lot of previously impossible use cases possible. E.g. grabbing a photo after a given interval, grabbing a video for a fixed number of seconds. Placing a UI element on top of the camera view etc.
One of the really cool things about this is that it’s entirely in a cn1lib. That means you can grok the code without understanding Codename One. You can fix issues and add functionality without knowing too much.
As a sidenote the reason we picked up this task is because an enterprise customer asked for this… If you can afford an enterprise account we really appreciate it and everyone gets the benefit of the new functionality!
So if the company you work for can purchase an enterprise account this can help everyone who uses Codename One.
Status & Future
Right now only a part of the functionality is implemented on iOS with some nuances still missing. On Android we get errors due to a bug in the native Android Camera Kit library. Since the native library is heading for a 1.0 version this should be resolved when we update to that.
I would love to see ports of this to other Codename One platforms and the simulator. We’ll take a look at these as we move forward based on user demand.