Description
As our team decides on the direction of the camera plugin, I wanted to create this issue to keep the community updated on our decisions and to catalog the highest requested features and issues with the current implementation.
Below are what I found are a combination of the main requested features and issues. Please feel free to let us know if there is anything else we should also consider.
We’ll update this issue when we have come up with a design.
Support Android Camera 16+:
In order to support 16+, we will have to use the Camera API. (As opposed to Camera2). This comes at the expense of features only available on Camera2. The alternative would be to maintain both an api for 16-20 and 21+.
Also note that CameraX will be discussed at I/O and could be used in the Android implementation.
Support iOS Camera 8.0+
We currently use AVCapturePhotoOutput to take photos. For 8.0-10.0, we would need to use AVCaptureStillImageOutput.
We also use AVCaptureDeviceDiscoverySession to find available devices. We could use AVCaptureDevice.devicesWithMediaType: for 8.0-10.0.
Camera Orientation Control
flutter/plugins#1452
#27201
#25232
On iOS, this feature is controlled by AVCaptureVideoOrientation. On Android, the Camera API has setDisplayOrientation and there is no equivalent feature on the Camera2 API.
Video/Preview/Picture output sizes
flutter/plugins#1403
flutter/plugins#1186
flutter/plugins#1107
#15953
#20994
Currently we use preview presets. But, it would probably be best to expose all available formats.
Android Pause and Resume video recording (MediaRecorder)
Zoom Control
We would expose the zoom feature on both platforms. Similar to the above PR.
Flash
We would expose the flash feature on both platforms. Similar to the above PR.
Automatic Exposure
We would expose the AE feature on both platforms. Similar to the above PR.
Permission Handling (Camera/Audio)
flutter/plugins#904
flutter/plugins#837
flutter/plugins#823
#19670
The solution to this one is a little bit more complicated. Below are proposed solutions:
-
Remove permissions from the plugin entirely. This would require users to use a separate plugin to handle permissions. Currently, there isn’t any first party plugin that supports this, but there are a few popular external ones. (e.g. permission_handler, simple_permissions)
-
Don’t automatically handle permissions when accessing the camera, but expose the api and allow the user to ask for permissions when they want.
Auto Focus
We would expose the AF feature on both platforms. Similar to the above PR.
Memory Leak
Currently no solution for this, but could likely be related to not deallocating the FlutterTexture.