react-native-vision-camera
react-native-vision-camera copied to clipboard
๐ Unable to scan code-39 barcode.
What's happening?
Camera is unable to detect a code-39 barcode.
Reproduceable Code
const codeScanner = useCodeScanner({
codeTypes: ['qr', 'ean-13', 'code-39', 'code-128', 'code-93', 'data-matrix'],
onCodeScanned: (codes) => {
console.log(codes)
},
})
<Camera
codeScanner={codeScanner}
style={{ flex: 1 }}
androidPreviewViewType="texture-view"
device={device}
></Camera>
Relevant log output
Loading react-native-worklets-core...
Worklets loaded successfully
VisionCameraProxy: Creating Worklet Context...
VisionCameraProxy: Worklet Context Created!
23:53:31.350: [info] ๐ธ VisionCamera.constantsToExport(): Found 5 initial Camera Devices.
23:53:35.991: [info] ๐ธ VisionCamera.didSetProps(_:): Updating 20 props: [onInitialized, cameraId, codeScannerOptions, enableBufferCompression, onOutputOrientationChanged, onCodeScanned, preview, onStarted, isActive, isMirrored, onViewReady, onError, onStopped, onPreviewOrientationChanged, onPreviewStopped, enableFrameProcessor, onPreviewStarted, flex, torch, onShutter]
23:53:35.994: [info] ๐ธ VisionCamera.configurePreviewOrientation(_:): Updating Preview rotation: portrait...
23:53:35.994: [info] ๐ธ VisionCamera.configureOutputOrientation(_:): Updating Outputs rotation: portrait...
23:53:35.994: [info] ๐ธ VisionCamera.configure(_:): configure { ... }: Waiting for lock...
23:53:35.999: [info] ๐ธ VisionCamera.configure(_:): configure { ... }: Updating CameraSession Configuration... Difference(inputChanged: true, outputsChanged: true, videoStabilizationChanged: true, orientationChanged: true, formatChanged: true, sidePropsChanged: true, torchChanged: true, zoomChanged: true, exposureChanged: true, audioSessionChanged: true, locationChanged: true)
23:53:35.999: [info] ๐ธ VisionCamera.configureDevice(configuration:): Configuring Input Device...
23:53:35.999: [info] ๐ธ VisionCamera.configureDevice(configuration:): Configuring Camera com.apple.avfoundation.avcapturedevice.built-in_video:0...
23:53:36.001: [info] ๐ธ VisionCamera.configureDevice(configuration:): Successfully configured Input Device!
23:53:36.001: [info] ๐ธ VisionCamera.configureOutputs(configuration:): Configuring Outputs...
23:53:36.001: [info] ๐ธ VisionCamera.configureOutputs(configuration:): Adding Code Scanner output...
23:53:36.002: [info] ๐ธ VisionCamera.configurePreviewOrientation(_:): Updating Preview rotation: portrait...
23:53:36.002: [info] ๐ธ VisionCamera.configureOutputOrientation(_:): Updating Outputs rotation: portrait...
23:53:36.002: [info] ๐ธ VisionCamera.configureOutputs(configuration:): Successfully configured all outputs!
23:53:36.004: [info] ๐ธ VisionCamera.setTargetOutputOrientation(_:): Setting target output orientation from device to device...
23:53:36.201: [info] ๐ธ VisionCamera.init(frame:session:): Preview Layer started previewing.
23:53:36.202: [info] ๐ธ VisionCamera.configure(_:): Beginning AudioSession configuration...
23:53:36.202: [info] ๐ธ VisionCamera.configureAudioSession(configuration:): Configuring Audio Session...
23:53:36.203: [info] ๐ธ VisionCamera.configure(_:): Committed AudioSession configuration!
23:53:36.203: [info] ๐ธ VisionCamera.configure(_:): Beginning Location Output configuration...
23:53:36.206: [info] ๐ธ VisionCamera.configure(_:): Finished Location Output configuration!
Camera Device
{
"isMultiCam": false,
"sensorOrientation": "portrait",
"formats": [],
"id": "com.apple.avfoundation.avcapturedevice.built-in_video:0",
"supportsRawCapture": false,
"neutralZoom": 1,
"physicalDevices": [
"wide-angle-camera"
],
"supportsFocus": true,
"minZoom": 1,
"supportsLowLightBoost": false,
"maxExposure": 8,
"position": "back",
"hardwareLevel": "full",
"hasTorch": true,
"minFocusDistance": 15,
"maxZoom": 123.75,
"minExposure": -8,
"name": "Back Camera",
"hasFlash": true
}
Device
iPhone 15 (17.6.1)
VisionCamera Version
4.5.2
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.
Guten Tag, Hans here! ๐ป
Thanks for providing all ze details, but we're missing some critical information. Can you please share any relevant logs from Xcode or adb logcat? This would really help mrousavy to understand ze issue better. If you havenโt done it yet, hereโs how to get ze logs:
- For iOS, run your app in Xcode and check ze console for any errors while scanning za barcode.
- For Android, use
adb logcatin your terminal while reproducing ze issue.
Looking forward to your reply!
Note: If you think I made a mistake, please ping
@mrousavyto take a look.
This barcode does not have enough quiet zone. You can try ZXing or Dynamsoft Barcode Reader to read it.
- https://github.com/xulihang/vision-camera-zxing
- https://github.com/tony-xlh/vision-camera-dynamsoft-barcode-reader/