react-native-vision-camera: š Frame Processor threw an error: Value is undefined, expected an Object
What were you trying to do?
Iām trying to integrate this community plugin : https://github.com/rodgomesc/vision-camera-code-scanner But Iām unable to make it work on iOS. It works great on Android though. I have tried other community plugin but the same error appear. In fact event a frame processor function with no code in it makes the error appear. Iāve also tried different version react-native-vision-camera, since some changes has been made since the last version of vision-camera-code-scanner.
Reproduceable Code
const ScanBarCodeScreen = (props: NavigationProps) => {
const [hasPermission, setHasPermission] = useState(false)
const devices = useCameraDevices()
const device = devices.back
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
console.log('hello')
}, [])
const isFocused = useIsFocused()
useEffect(() => {
(async () => {
const status = await Camera.requestCameraPermission()
setHasPermission(status === 'authorized')
})()
}, [])
return (
<>
<StatusBar backgroundColor={Theme.Color.White} barStyle="dark-content" />
<View
style={{
flex: 1,
flexDirection: 'column',
backgroundColor: 'black'
}}
>
<SafeAreaView
style={{
flex: 1,
justifyContent: 'space-between',
alignItems: 'center'
}}
>
{device != null && hasPermission && (
<Camera
style={StyleSheet.absoluteFill}
device={device}
isActive={isFocused}
frameProcessor={frameProcessor}
frameProcessorFps={1}
/>
)}
</SafeAreaView>
</View>
</>
)
}
What happened instead?
As soon as I arrive on my screen, and after giving permission to use the device camera, I get the error Frame Processor threw an error: Value is undefined, expected an Object
at every refresh.
The app does not crash but I obviously cannot use the frame processor.
Relevant log output
FrameProcessorBindings: Creating Runtime Manager...
FrameProcessorBindings: Runtime Manager created!
FrameProcessorBindings: Installing Frame Processor plugins...
FrameProcessorBindings: Installing Frame Processor plugin "__scanCodes"...
FrameProcessorBindings: Installing Frame Processor plugin "__labelImage"...
FrameProcessorBindings: Frame Processor plugins installed!
FrameProcessorBindings: Installing Frame Processor Bindings for Bridge...
FrameProcessorBindings: Installing global functions...
FrameProcessorBindings: Finished installing bindings.
[javascript] Running "TitrePrepayesApp" with {"rootTag":1,"initialProps":{}}
[native] [GESTURE HANDLER] Initialize gesture handler for root view <RCTRootContentView: 0x104e19640; reactTag: 1; frame = (0 0; 768 1024); gestureRecognizers = <NSArray: 0x282a4a220>; layer = <CALayer: 0x28243d5e0>>
[MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
[MC] Reading from public effective user settings.
[Common] _BSMachError: port b003; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
[javascript] 'Frameporcccc', [Function]
FrameProcessorBindings: Setting new frame processor...
FrameProcessorBindings: Adapting Shareable value from function (conversion to worklet)...
FrameProcessorBindings: Successfully created worklet!
FrameProcessorBindings: Converting worklet to Objective-C callback...
FrameProcessorBindings: Frame processor set!
[javascript] Frame Processor threw an error: Value is undefined, expected an Object
[javascript] Frame Processor threw an error: Value is undefined, expected an Object
[javascript] Frame Processor threw an error: Value is undefined, expected an Object
Device
iPad mini 2 on iOS 12.5.5
VisionCamera Version
2.11.2 ; 2.11.1 ; 2.9.4
Additional information
- I am using Expo
- I have read the Troubleshooting Guide
- I agree to follow this projectās Code of Conduct
- I searched for similar issues in this repository and found none.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 34 (7 by maintainers)
Commits related to this issue
- add frame processor - Need to clean metro cache. - https://github.com/mrousavy/react-native-vision-camera/issues/730 — committed to Lucianofc138/vcpb-issue-reproduction-0 by Lucianofc138 2 years ago
ok itās working now, I did the following:
that did it. I previously tried clean without resetting the cache but that didnāt help at all. npm start ā --reset-cache as suggested by @mrousavy seems to solve it
Yes, I need that function. In the future I have an alternative to Reanimated ready, so stay tuned
Does https://github.com/mrousavy/react-native-vision-camera/pull/698 fix the issue for you? Try rebuilding everything and cleaning cache (especially metro cache)
follow the answer in this link to solve the issue- stackoverflow link
@thelastwizardOC Mhmm actually i was trying to use it in relation to another package to implement QR-code scanning, so after getting stuck with react native vision camera i decided to up for āreact-native-qrcode-scannerā.