CamerAwesome
CamerAwesome copied to clipboard
[iOS] Camera usage indicator does not go away.
Steps to Reproduce
Create an app using camera_awesome, use the camera, then navigate to any other screen which is not using the camera anymore.
Expected results
On iOS there is a little green dot next to the battery indicator (See screenshot) , showing that the device is using the camera at this moment. It should disappear after navigating to any other screen which is not using the camera.

Actual results
The green dot does not disappear, even after disposing of any controller in the camera view.
About your device
Brand | Model | OS |
---|---|---|
Apple | iPhone 12 | 14.4 |
Any update on this?
Same on OnePlus 7 Pro (Android), the Pop-up front camera stays up after navigate to another screen Any fix for this ?
Any information on when this bug will be fixed ? @g-apparence
Hello, sorry I'm quite really busy this month. The problem is that we keep the state of the camera while you navigate. If you really want to force the camera to close you have to :
- replace the current pushed page
- force the previous page to close the camera before navigating (just remove the CamerAwesome preview from your page before navigating)
As CamerAwesome is started with your view this behavior is totally "normal". We can think of a way to make it better. If you have any suggestions on what you want I'm open.
I tried to work around this using WidgetsBinding.instance.addObserver(this)
and implementing didChangeAppLifecycleState
. If the AppLifecycleState
is anything other than resumed
, I call CamerawesomePlugin.stop()
- and the indicator light goes out. On resume I call `CamerawesomePlugin.start()', and it works OK.
I'm working on a problem I see the first time the app is executed. It pauses to ask for camera permissions, when they are granted I see this error:
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(CAMERA_MUST_BE_INIT, init must be call before start, , null)
I'll continue investigating, and will post results here.
Looks like the plugin is in a weird state the very first time the camera is used (when it's asking for permission). CamerawesomePlugin.currentState is STOPPED
, but calling start()
gives the error I mentioned.
So I implemented the AppLifecycle state as described above, stopping and starting the plugin as the app lifecycle changes, except I don't call start()
when the lifecycle change is immediately after the permission grant.
That works fine: first time startup behaves as expected, and now use of the camera (and the indicator light) correctly follows the app state.
This seems like an easy fix at first sight.
Sorry I don't have time right now to take a look, but I keep this in "to do".
this makes the battery wasteful, because the camera is open again after dispose. both on android and on ios. i added the following code on the screen after open camera,
Future.delayed( const Duration( seconds: 1), () {
CamerawesomePlugin.stop();
});