react-native-vision-camera
react-native-vision-camera copied to clipboard
🐛 Camera.onError(device/no-device)
What's happening?
I got an error about the camera device although the camera can open.
Reproduceable Code
export default function App() {
const [hasPermission, setHasPermission] = useState(false);
const [isActive,setIsActive] = useState(true);
const device = useCameraDevice("back");
useEffect(() => {
(async () => {
const status = await Camera.requestCameraPermission();
setHasPermission(status === 'granted');
setIsActive(true);
})();
}, []);
return (
<SafeAreaView style={styles.container}>
{device != null &&
hasPermission && (
<>
<Camera
style={StyleSheet.absoluteFill}
isActive={isActive}
device={device}
pixelFormat='yuv'
/>
</>)}
</SafeAreaView>
);
}
Relevant log output
LOG Running "VisionCameraCropperExample" with {"rootTag":11}
LOG Loading react-native-worklets-core...
LOG Worklets loaded successfully
ERROR Camera.onError(device/no-device): [device/no-device] No device was set! Use `useCameraDevice(..)` or `Camera.getAvailableCameraDevices()` to select a suitable Camera device. [device/no-device: [device/no-device] No device was set! Use `useCameraDevice(..)` or `Camera.getAvailableCameraDevices()` to select a suitable Camera device.]
Camera Device
{
"formats": [],
"sensorOrientation": "landscape-left",
"hardwareLevel": "full",
"maxZoom": 10,
"minZoom": 1,
"maxExposure": 18,
"supportsLowLightBoost": false,
"neutralZoom": 1,
"physicalDevices": [
"wide-angle-camera"
],
"supportsFocus": true,
"supportsRawCapture": true,
"isMultiCam": false,
"minFocusDistance": 5,
"minExposure": -18,
"name": "BACK (0)",
"hasFlash": true,
"hasTorch": true,
"position": "back",
"id": "0"
}
Device
OPPO A72 5G Android 12
VisionCamera Version
3.9.0
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (⚠️ your issue might get ignored & closed if you don't try this)
Additional information
- [ ] I am using Expo
- [X] I have enabled Frame Processors (react-native-worklets-core)
- [X] I have read the Troubleshooting Guide
- [X] I agree to follow this project's Code of Conduct
- [X] I searched for similar issues in this repository and found none.