🐛 Worklet Issue
What's happening?
I am trying to get raw Data for live stream. I use frameProcessor for get the frame and frame.toArrayBuffer() for RGB data.Now i want further process for collection the RawData.Even i used the runAsync in FrameProcessor but not success.
Reproduceable Code
const frameProcessor = useFrameProcessor((frame) => {
'worklet';
try {
const height = frame.height;
const width = frame.width;
const bytesPerRow = frame.bytesPerRow
const buffer = frame.toArrayBuffer()
const rawData = new Uint8Array(buffer)
runAsync(frame, () => {
'worklet'
console.log("I'm running asynchronously, possibly at a lower FPS rate!")
})
}
console.log(`Pixel at 0,0: RGB(${rawData[0]}, ${rawData[1]}, ${rawData[2]})`)
// Process the frame here
} catch (e) {
console.error('Frame Processor Error:', e.message);
}
}, []);
Relevant log output
Frame Processor Error: Regular javascript function '' cannot be shared. Try decorating the function with the 'worklet' keyword to allow the javascript function to be used as a worklet., js engine: VisionCamera.
Camera Device
{
"formats": [],
"sensorOrientation": "landscape-left",
"hardwareLevel": "full",
"maxZoom": 8,
"minZoom": 1,
"maxExposure": 12,
"supportsLowLightBoost": false,
"neutralZoom": 1,
"physicalDevices": [
"wide-angle-camera"
],
"supportsFocus": true,
"supportsRawCapture": false,
"isMultiCam": false,
"minFocusDistance": 7.000000066757203,
"minExposure": -12,
"name": "0 (BACK) androidx.camera.camera2",
"hasFlash": true,
"hasTorch": true,
"position": "back",
"id": "0"
}
Device
on every device
VisionCamera Version
4.3.2
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.
Guten Tag, Hans here.
[!NOTE] New features, bugfixes, updates and other improvements are all handled mostly by
@mrousavyin his free time. To support@mrousavy, please consider 💖 sponsoring him on GitHub 💖. Sponsored issues will be prioritized.
Please try if you can reproduce in the example app. If not, then it is a bug on your end. Maybe you have reanimated installed, then you need to enable processNestedWorklets in babel config.
Either way this should probably be posted in react-native-worklets-core repo.