Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
952 stars 241 forks source link

Camera crashes when exiting and re-entering page #81

Closed jarren-meep closed 2 years ago

jarren-meep commented 3 years ago

When I run the camera the first time, it works fine (takes pictures and stuff and works good). But after I exit the page by Navigator.push and re-visit it, the camera will crash,

My code that shows the CameraAwesome widget

...
Container(
                            child: CameraAwesome(
                              testMode: false,
                              selectDefaultSize: (List<Size> availableSizes) {
                                print(availableSizes);
                                return Size(640.0, 480.0);
                              },
                              onPermissionsResult: _onPermissionsResult,
                              onCameraStarted: () {},
                              onOrientationChanged: (CameraOrientations newOrientation) {},
                              sensor: _sensor,
                              switchFlashMode: _switchFlash,
                              captureMode: _captureMode,
                              orientation: DeviceOrientation.portraitUp,
                              fitted: false,
                              enableAudio: _enableAudio,
                              photoSize: _photoSize,
                            ),
...

bug When loading up the page a second time, this will appear on vscode when ran in debug mode. ^^

_I suspect it's something related to https://github.com/Apparence-io/camera_awesome/issues/61, because texture was mentioned in the code after init, maybe?? ;D_

g-apparence commented 3 years ago

Hello, sorry for late reply. Could you post a complete code that reproduces the error?

jarren-meep commented 3 years ago

Hey! Sorry I left this hanging, had other priorities and issues to solve first, and couldn't get to replying to this

I created a small example repo for the problem at hand, Link is here

Basically whenever I Navigator.push from Camera page to other page and back to Camera page, the camera just stops working :/ I'm using push here because in my app, I display images that have just been taken to the user, and I'm not sure how to do it with Navigator.pop when it doesn't update state.

Hope you can get to look at it, thanks!

jamesdixon commented 3 years ago

@jarren-meep is this on Android, iOS or both?

jarren-meep commented 3 years ago

@jamesdixon both

g-apparence commented 2 years ago

I think last versions should have fixed this. Didn't reproduced it. Don't hesitate to open a new issue if that's still true