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.
Activity
jbts6 commentedon Apr 19, 2019
How about support a USB Camera?
josh-burton commentedon Apr 19, 2019
Might be worth mentioning that there is a CameraX library for Android expected to be announced at Google IO. This might simplify implementing the Android side of things quite a bit.
bparrishMines commentedon Apr 23, 2019
@fh I believe iOS and Camera2 for Android both support external cameras automatically by referencing their ids. However, I haven't tried using one yet.
https://source.android.com/devices/camera/external-usb-cameras
https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture?language=objc
ghost commentedon May 10, 2019
CameraX was announced to be min api 21 , so we still need camera instead of camera2 to support 16 -to 21
Goolpe commentedon May 17, 2019
@bparrishMines there is a problem on some devices(Xiaomi, Samsung Tab...) with stopVideoRecording (camera: 0.5.2+1)
#31414
#18138
#23039
googlearchive/android-Camera2Video#46
Solution for me was
add to
PerLycke commentedon May 27, 2019
camerax surely sounds promising. The amount of testing needed on different devices using the current implementation with camera2 is very resource demanding. I guess we need to figure out how to bind the preview in camerax to Flutter's texture
164 remaining items
mvanbeusekom commentedon Mar 2, 2021
@jdeltoft yes please it would be easier to track if we have a separate issue.
At the moment a temp file is generated when you call
startVideoRecording
and it’s returned as anXFile
when calling thestopVideoRecording
method.jdeltoft commentedon Mar 9, 2021
Thanks @mvanbeusekom , i was able to get the
XFile
fromstopVideoRecording
and use that with video player to preview it. It worked suprisingly well out of the gate, but I had to be careful with my pubspec as I was including vimeo player which has older video player dependencies still. Anyway, for my case I don't really care where this file is temporarily stored, as I just want to email out a clip if the user chooses. Thanks!amirjalali1 commentedon Mar 20, 2021
Is there any way to pass the video path to FFmpeg as input for the RTMP stream while recording? Is there any way to stream camera-input without recording?
wenxiangjiang commentedon Mar 27, 2021
Do you have any updates about usb camera?
jordanhart commentedon Mar 28, 2021
Are there any thoughts or timelines for Web and Desktop support?
bparrishMines commentedon Mar 29, 2021
Since most of the issues and PRs have been closed and I want to discourage adding additional work for this issue, I'm going to go ahead and close it. For additional feature requests or bugs, please file new issues or upvote existing ones. The only issues/PRs included in this issue that are not closed or merged are:
#27201
#25232
#15953
#19515
ccadieux commentedon Apr 27, 2021
@bparrishMines The Readme.md links to this issue.
bparrishMines commentedon Jun 1, 2021
Thanks, @ccadieux. I created #83722
github-actions commentedon Jul 30, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -v
and a minimal reproduction of the issue.