mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.49k stars 1.09k forks source link

🐛 when frameprocessor is on app closes automatically #3146

Closed saransathish closed 2 months ago

saransathish commented 2 months ago

What's happening?

`import React from 'react'; import { View } from 'react-native'; import { Camera, useCameraFormat, useFrameProcessor } from 'react-native-vision-camera';

interface FrameProcessingProps { device: any; model: any; }

const frameProcessor = useFrameProcessor((frame) => { 'worklet' console.log(Frame: ${frame.width}x${frame.height} (${frame.pixelFormat})) }, [])

return ( <View style={{ flex: 1 }}> <Camera style={{ flex: 1 }} device={device} isActive={true} frameProcessor={frameProcessor} /> ); };

export default FrameProcessing; ` In the above i uses the frameprocessor for some ml task but it wont work then i just used the simple console statement it also close the apps automatically pls any one help me to solve this issue.

Reproduceable Code

<Camera
        style={{ flex: 1 }}
        device={device}
        isActive={true}
        frameProcessor={frameProcessor}
      />

Relevant log output

info Starting logkitty
[11:58:01] I | ReactNativeJS ▶︎ Running "newlearning" with {"rootTag":11}

[11:58:02] I | ReactNativeJS ▶︎ Loading react-native-worklets-core...

[11:58:02] I | ReactNativeJS ▶︎ Worklets loaded successfully

[11:58:02] I | ReactNativeJS ▶︎ Installing bindings...

[11:58:02] I | ReactNativeJS ▶︎ Successfully installed!

[11:58:02] I | ReactNativeJS ▶︎ Loading Tensorflow Lite Model 1

[11:58:02] I | ReactNativeJS ▶︎ Resolved Model path: http://localhost:8081/assets/src/assets/my-modal.tflite?platform=android&hash=a271e231db0296a6e9133ba046fd36a5

[11:58:02] I | ReactNativeJS ▶︎ Model loaded!

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "full",
  "maxZoom": 10,
  "minZoom": 1,
  "maxExposure": 20,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": false,
  "minFocusDistance": 10,
  "minExposure": -20,
  "name": "0 (BACK) androidx.camera.camera2",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

vivo t2 pro - android 14

VisionCamera Version

4.5.2

Can you reproduce this issue in the VisionCamera Example app?

No, I cannot reproduce the issue in the Example app

Additional information

maintenance-hans[bot] commented 2 months ago

Guten Tag, Hans here! 🍻 Thanks for providing ze detailed information, but I see a few issues with your report. While you’ve shared some logs, it would help to include specific runtime logs from adb logcat so mrousavy can better understand what’s happening when ze app crashes. If you need assistance on how to gather those logs, just let me know! Also, make sure ze code you’re using matches the example usage in ze documentation. In ze meantime, if you find ze project helpful, consider supporting it by sponsoring mrousavy!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

parice02 commented 2 months ago

Same issue:

Error message:

Your app just crashed. See the error below.
com.facebook.jni.CppException: Regular javascript function 'rethrowErrorOnJS' cannot be shared. Try decorating the function with the 'worklet' keyword to allow the javascript function to be used as a worklet.
parice02 commented 2 months ago

Updating react-native-worklets-core to 1.3.3 fixes the problem for me.

mrousavy commented 2 months ago

You probably don't have "processNestedWorklets" enabled in the reanimated babel plugin. You can also try to use it without reanimaed and only use worklets core.

coofzilla commented 1 month ago

Updating react-native-worklets-core to 1.3.3 fixes the problem for me.

you saved me! had the exact error. thank you :)