react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 [device/parallel-video-processing-not-supported] It seems I can't use frameProcessors for some Samsung devices

Open keShraa opened this issue 3 years ago • 0 comments

What were you trying to do?

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 either video or frameProcessor. To find out if a device supports parallel video processing, check the supportsParallelVideoProcessing property 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.

Reproduceable Code

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}
        />
    )
}

What happened instead?

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. 🙏🏻

Relevant log output

[device/parallel-video-processing-not-supported] The given **LEGACY Camera device does not support parallel video processing** (`video={true}` + `frameProcessor={...}`). Disable either `video` or `frameProcessor`. To find out if a device supports parallel video processing, check the `supportsParallelVideoProcessing` property on the CameraDevice. See https://mrousavy.github.io/react-native-vision-camera/docs/guides/devices#the-supportsparallelvideoprocessing-prop for more information.]

Device

Samsung Galaxy A53 5G (SM-A536B/DS)

VisionCamera Version

2.14.0

Additional information

Same issue posted on vision-camera-code-scanner repo

keShraa avatar Aug 03 '22 15:08 keShraa