Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

iOS - worklet error , Android - undefined error #35

@hasunpark

Description

@hasunpark

Hi guys i was heading some issue with iOS and Android both.

Android:

Frame Processor threw an error: undefined is not a function 

iOS:

Error: Javascript worklet error
    at _f (native)

Error: Exception in HostFunction: Javascript worklet error
...

i fixed it by directly using __scanCodes

here is example code that fully works for me

Solution

export const Scanner: React.FC = () => {
  const devices = useCameraDevices();
  const device = devices.back;

  const frameProcessor = useFrameProcessor(frame => {
    'worklet';
    const barcodes = __scanCodes(frame, [BarcodeFormat.ALL_FORMATS]);
  }, []);

  if (device == null) return <></>;
  return (
    <Camera
      style={{flex: 1}}
      device={device}
      isActive={true}
      frameProcessor={frameProcessor}
      frameProcessorFps={5}
    />
  );
};

i'm not sure that exactly why this works. But i will work around when i have some time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions