[device/parallel-video-processing-not-supported] It seems I can't use frameProcessors for some Samsung devices
Issue
Hi guys,
As mentioned in the title, I can't use frameProcessors for some Samsung devices (Samsung A51, A52, A53...).
I'm using this awesome library react-native-vision-camera combined with vision-camera-code-scanner to scan barcodes for my application.
It works perfectly with my others devices (Google Pixel 4A, iPhone X...) but with those Samsung devices, the camera component doesn't even initialize and I have this error message:
[device/parallel-video-processing-not-supported] The given LEGACY Camera device does not support parallel video processing (
video={true}+frameProcessor={...}). Disable eithervideoorframeProcessor. To find out if a device supports parallel video processing, check thesupportsParallelVideoProcessingproperty on the CameraDevice. See https://mrousavy.github.io/react-native-vision-camera/docs/guides/devices#the-supportsparallelvideoprocessing-prop for more information.]
I understand that the device doesn't support parallel video processing device.supportsParallelVideoProcessing = false but I should be able to disable the video and activate frame processors. (Cf documentation)
Camera devices provide the supportsParallelVideoProcessing property which determines whether the device supports using Video Recordings (video={true}) and Frame Processors (frameProcessor={...}) at the same time. If this property is false, you can either enable video, or add a frameProcessor, but not both.
Implementation
import { Camera, useCameraDevices, sortFormats } from 'react-native-vision-camera';
import { useScanBarcodes, BarcodeFormat } from 'vision-camera-code-scanner';
export const CameraComponent = props => {
const [frameProcessor, barcodes] = useScanBarcodes([...]);
// Camera configuration (ref, isFocused, isActive, device, format...)
[...]
if (device == null || permission === 'denied') return [...]
return (
<Camera
ref={camera}
device={device}
isActive={isActive}
// Disable video and should be able to use frameProcessor
photo={true}
video={false}
audio={false}
frameProcessor={frameProcessor}
frameProcessorFps={frameProcessorFps || 1}
flash={supportsFlash ? flash : 'off'}
lowLightBoost={device?.lowLightBoost}
fps={fps}
{...(preset
? { preset }
: {
format: format,
hdr: format?.supportsPhotoHDR,
})}
onInitialized={onInitialized}
onError={onError}
style={StyleSheet.absoluteFill}
/>
)
}
This gives me a black screen if the device's supportsParallelVideoProcessing property if false. I thought that I would fix this by disabling the video, but nope 😅 ! Can you help me with this ?
Tell me if you need more information. 🙏🏻
Config
- MacBook, Apple M1 Pro
- MacOS Monterey 12.4
- Android Studio Chipmunk | 2021.2.1 Patch 1
- Samsung Galaxy A53 5G (SM-A536B/DS)
- Android 12
package.json
"react": "17.0.2",
"react-native": "0.67.2",
"react-native-vision-camera": "2.14.0",
"vision-camera-code-scanner": "0.2.0"
build.gradle
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "21.4.7075529"
androidXCore = "1.0.2"
classpath 'com.android.tools.build:gradle:7.0.4'
app/build.gradle
implementation "com.facebook.react:react-native:+"
implementation 'androidx.multidex:multidex:2.0.1'
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
Same issue posted on react-native-vision-camera repo
tested on a Samsung S9 : ok
"dependencies": { "react": "18.0.0", "react-native": "0.69.4", "react-native-reanimated": "^2.9.1", "react-native-vision-camera": "^2.14.1", "vision-camera-code-scanner": "^0.2.0" },
Still an issue with some devices.