With commit 772185f we have added support for camera device on iOS (iOS 7+) and Android (API 21+). To enable camera support, switch JUCE_USE_CAMERA to
The DemoRunner app now enables camera by default, so you can play with it on Mac, Windows, iOS and Android.
As for other mobile features, you need to request permission from a user to access the camera. On Android you need to specify camera permission in Projucer setting:
Similarly on iOS, you need to enable the
Camera Access Projucer option. There is an optional description you can set describing why you need a camera permission with a default text:
On top of Projucer settings above, JUCE will automatically request permissions from a user at runtime (you still need to enable the permissions in Projucer).
To make an existing code to work on iOS and Android, there are minimal changes required on your end:
openDevice()on all platforms. Async opening is required on iOS/Android and it will just call
openDevice()for Mac/Windows. You can still use
openDevice()on desktop but that will not work on iOS/Android
takeStillPicture()to capture photos passing a lambda that will be called to notify you when the photo has been taken, the old
CameraDevice::Listenerclass has been removed
CameraDevice::onErrorOccurredlambda to be notified if any error occurs in a device. Usually when an error occurs, the device will have to be closed and reopened.
In case you encounter any issues, you can set
JUCE_CAMERA_LOG_ENABLED flag to get a lot of debug information as well as info on camera capabilities.
Finally, we realise that modern mobile devices support tons of features like capturing raw images and that the devices allow to fine control various settings e.g. focus, exposure, white balance and so on. Time permitting, we will add support for these, but we can’t promise any timeline at this point. With this increment we made iOS and Android implementations use the same capabilities as Mac and Windows ones, which is already a big chunk of work and a step towards further improvements and features.