Comments (4)
You could only run the camera if the screen is active. If the camera doesn't run, the frame processor should not either. So something like:
import { useNavigation } from 'expo-router';
...
const navigation = useNavigation();
const isScreenFocused = navigation.isFocused();
...
<Camera
...
isActive={isScreenFocused}
/>
from react-native-vision-camera.
I understood you that I should set the active
property false
when the screen is not focus, but I am already doing this,
<Camera
style={StyleSheet.absoluteFillObject}
ref={cameraRef}
device={device}
isActive={isActive}
photo={true}
format={format}
fps={fps}
orientation="portrait"
photoQualityBalance="speed"
// enableFpsGraph={true}
frameProcessor={frameProcessor}
/>
the isActive={isActive}
set this to false
when the screen is not focus or when the app is in second plane. This seems to work fine, but when I use frameProcessor={frameProcessor}
this is still running when the screen is not focus.
from react-native-vision-camera.
Strange, maybe it's a regression on a new version? In this case you could pass isActive
as a dependency of the frame processor and not run what's inside if it is false, like:
useFrameProcessor((frame) => {
if (!isActive) return;
...
}, [isActive]);
from react-native-vision-camera.
@gwendall you were right, ty. It seems that I was setting the isActive
in a wrong way. Ty man
from react-native-vision-camera.
Related Issues (20)
- ๐ญ Hello, Which version of react-native-vision-camera supports RN 0.67? HOT 1
- Build failed with face-detector plugin๐ง HOT 3
- ๐ Torch does not work on CodeScanner HOT 2
- ๐ญ How to translate preview point to screen point with resizeMode contain? HOT 2
- ๐ Error when switching front camera on iPhone HOT 2
- ๐ On some Android devices, the camera image is very dark and almost invisible HOT 1
- ๐ Different metadata frame count and decoded frame count HOT 4
- ๐ Camera preview blank screen when using Skia Frame Processors HOT 10
- ๐ Camera Preview is Stretched on ShadowLens App on a Samsung J6 (Android 10) HOT 1
- โจ How can I save the video recording when the app state changes to "background" or "inactive". HOT 1
- ๐ Mirror issue with front camera HOT 6
- Using react-native-vision-camera 4.0.5 there is increase of 3MB size in android bundle HOT 3
- ๐ ERROR Camera.onError(session/recoverable-error): An unknown error occurred while creating the Camera Session, but the Camera can recover from it. [session/recoverable-error: An unknown error occurred while creating the Camera Session, but the Camera can recover from it.] HOT 4
- ๐ Android's getCameraPermissionStatus and getLocationPermissionStatus always returned 'denied' on a fresh install of the app HOT 1
- ๐ No onOutputOrientationChanged event on v4.1.0 HOT 2
- ๐ useSkiaFrameProcessor renders black screen using front cameras HOT 15
- I am getting react-native-vision-camera:compileDebugKotlin'. error๐ง HOT 5
- ๐ Camera preview doesn't show the full image even with resizeMode='contain' HOT 3
- orientationOutput isn't applied in IOS with skia HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-vision-camera.