androidiosfluttercameraandroid-camera2

Options to set Automatic White Balance (AWB) & other low level camera settings using flutter camera plugin


I'm building a flutter app which records a video and saves it to a local file. While recording the video I need to set values/enable/diable Automatic White Balance (AWB),exposure, ISO & other low level setting of the on device camera so that there is minimal variation of video quality (colour & light) across devices.

The main "camera: ^0.11.0+1" flutter plugin https://pub.dev/packages/camera does not provide a way to set values or enable/disable AWB, exposure, ISO, etc for on device camera. Though this is achievable through the underlaying APIs of Android & iOS as specified in their documentation. Even the "camerawesome" flutter plugin does not allow AWB & other camera sensor setting values to be set while capturing a video.

So is there a way to write custom code or a workaround to set automatic WB, ISO, exposure, & other low level setting values while using default camera v0.11.0 plugin to develop a flutter app.


Solution

  • Unfortunately if you can’t find any packages that don’t support low level control during video capture, you’d have to implement the additional functionality yourself.

    You’d have to use method channels to communicate between your Dart code and the native code for Android (Kotlin) and iOS (Swift). I believe it will be the CameraX or Camera2 API for advanced camera controls for Andoid and AVFoundation framework for iOS. If you’re not familiar with these I’d suggest to have a read of the Android and iOS documentation and see how camera or awesomecamera have implemented their method channels and native code.

    Even better would be if you could fork the plugin you decide to go with, add the functionality and create a PR.