react-native-vision-camera
react-native-vision-camera copied to clipboard
If I using USB type external camera that not showing in android and it only shows the back(0 index) and front(1 index) but not showing the external(2 index).🐛
What's happening?
If I using USB type external camera that not showing in android and it only shows the back(0 index) and front(1 index) but not showing the external(2 index). can you please look around it and fix this. it's not showing the external device in -> getAvailableDevice(). 🐛
Reproduceable Code
import {Alert, StyleSheet, Text, View} from 'react-native';
import React, {useEffect} from 'react';
import {
Camera,
useCameraDevice,
useCameraPermission,
useMicrophonePermission,
} from 'react-native-vision-camera';
import {useIsFocused} from '@react-navigation/native';
import {useAppState} from '@react-native-community/hooks';
const ExternalCameraScreen = () => {
const {hasCamPermission, requestCamPermission} = useCameraPermission();
const {hasMicPermission, requestMicPermission} = useMicrophonePermission();
const NoCameraDeviceError = () => (
<View>
<Text
style={{
color: 'black',
fontSize: 16,
alignItems: 'center',
justifyContent: 'center',
alignSelf: 'center',
marginTop: 10,
}}>
No camera device found
</Text>
</View>
);
const devices = Camera.getAvailableCameraDevices();
const device = useCameraDevice('external');
const usbCamera = useCameraDevice('external');
const external = usbCamera || device;
console.log('usbCamera >>>',usbCamera)
const isFocused = useIsFocused();
const appState = useAppState();
const isActive = isFocused && appState === 'active';
devices.map(device => {
console.log('device', device.name);
});
}, []);
if ((external || device || usbCamera) == null) return <NoCameraDeviceError />;
return <Camera style={{flex: 1}} device={external} isActive={isActive} />;
if (usbCamera != null) {
return (
<Camera
style={{ flex: 1 }}
device={usbCamera}
isActive={isActive}
/>
)
} else {
return (
<Camera
style={{ flex: 1 }}
device={device}
isActive={isActive}
/>
)
}
};
export default ExternalCameraScreen;
const styles = StyleSheet.create({});
Relevant log output
LOG: usbCamera >>> undefined
LOG: device back(0), front(1)
Camera Device
{
"sensorOrientation": "landscape-right",
"hardwareLevel": "full",
"maxZoom": 8,
"minZoom": 1,
"maxExposure": 8,
"supportsLowLightBoost": false,
"neutralZoom": 1,
"physicalDevices": [
"wide-angle-camera"
],
"supportsFocus": true,
"supportsRawCapture": true,
"isMultiCam": false,
"minExposure": -8,
"name": "BACK (0)",
"hasFlash": true,
"hasTorch": true,
"position": "back",
"id": "0"
},
{
"sensorOrientation": "landscape-right",
"hardwareLevel": "full",
"maxZoom": 8,
"minZoom": 1,
"maxExposure": 8,
"supportsLowLightBoost": false,
"neutralZoom": 1,
"physicalDevices": [
"wide-angle-camera"
],
"supportsFocus": true,
"name": "FRONT (1)",
"position": "back",
"id": "0"
}
Device
Vivo Y73
VisionCamera Version
3.6.14
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
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.