Fork us on GitHub

Camera Kit - Low Level Camera API

New camera access cn1lib API that gives you far more control
Camera Kit - Low Level Camera API

Camera Kit - Low Level Camera API

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.
Our current 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.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.