Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Close CameraSession if the View is removed #2174

Merged
merged 4 commits into from
Nov 18, 2023

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Nov 18, 2023

What

Closes the CameraSession and performs necessary cleanup (CaptureSession, CameraDevice, OpenGL context, Video & Photo outputs, RecordingSession, FrameProcessor and Photo Synchronizer) to free the Camera Hardware once the View is removed from the React hierarchy ("unmounted").

I previously simply forgot to do that. lol.

Changes

Tested on

Related issues

Copy link

vercel bot commented Nov 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2023 1:54pm

@mrousavy mrousavy merged commit a7e7061 into main Nov 18, 2023
5 checks passed
@mrousavy mrousavy deleted the fix/close-camera-android branch November 18, 2023 13:58
@spsaucier
Copy link

@mrousavy What are these changes accomplishing beyond clean-up? More to the point, what effect would it have if I reverted this PR in my app (it is causing most of our crashes - see #2210)?

isaaccolson pushed a commit to isaaccolson/deliveries-mobile that referenced this pull request Oct 30, 2024
* fix: Close `CameraSession` if the View is removed

* fix: Use ViewManager's `onDropViewInstance` instead

* fix: Only stop repeating if we have a session

* fix: Reset `configuration` on `close()`
@kojoo112
Copy link

THANK YOU 😭😭😭😭😭😭😭😭😭😭
I solved this problem. I updated my app. Thanks to you.
I hope you have a happy christmas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment