Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stretched camera image 🐛 #2364

Closed
4 of 5 tasks
MateusAnderle opened this issue Jan 9, 2024 · 51 comments
Closed
4 of 5 tasks

Stretched camera image 🐛 #2364

MateusAnderle opened this issue Jan 9, 2024 · 51 comments
Labels
🐛 bug Something isn't working

Comments

@MateusAnderle
Copy link

What's happening?

I am experiencing an issue with the camera view in my React Native app where the camera image appears horizontally stretched. I am using version 3.7.0 of the react-native-vision-camera library.

However, in development, when I make some changes inside the style and save, it updates the application and corrects the stretching issue. However, I can't track down the error.

Reproduceable Code

<Box flex={1} bgColor="#000" position="relative">
        <TouchableOpacity
          style={{
            backgroundColor: 'rgba(0,0,0,0.5)',
            borderRadius: 40,
            justifyContent: 'center',
            alignItems: 'center',
            height: 50,
            width: 50,
            top: 50,
            left: 20,
            zIndex: 5,
            position: 'absolute',
          }}
          onPress={onBackButton}
        >
          <Icon as={Ionicons} name="arrow-back" size={6} color="white" />
        </TouchableOpacity>
        <VisionCamera
          ref={cameraRef}
          style={{ flex: 1 }}
          device={device}
          format={format}
          isActive
          orientation="portrait"
          photo
        />
        <View style={{ padding: 16, flexDirection: 'row', gap: 16 }}>
          <Button flex={1} onPress={takePicture} disabled={takingPicture}>
            Tirar foto
          </Button>

          <Button flex={1} onPress={handlePickImage} disabled={takingPicture}>
            Escolher foto
          </Button>
        </View>
      </Box>

Relevant log output

There are no error logs

Camera Device

Variable format:

{
   "autoFocusSystem":"contrast-detection",
   "fieldOfView":77.50570519625971,
   "maxFps":60,
   "maxISO":3000,
   "maxZoom":4,
   "minFps":1,
   "minISO":40,
   "photoHeight":720,
   "photoWidth":1280,
   "pixelFormats":[
      "yuv",
      "native"
   ],
   "supportsDepthCapture":false,
   "supportsPhotoHdr":false,
   "supportsVideoHdr":false,
   "videoHeight":1080,
   "videoStabilizationModes":[
      "off",
      "off",
      "cinematic-extended"
   ],
   "videoWidth":1920
}

Device

Samsung galaxy A10

VisionCamera Version

3.7.0

Can you reproduce this issue in the VisionCamera Example app?

No, I cannot reproduce the issue in the Example app

Additional information

@MateusAnderle MateusAnderle added the 🐛 bug Something isn't working label Jan 9, 2024
@leppid
Copy link

leppid commented Jan 9, 2024

Same here!

@iqorlobanov
Copy link

As a workaround, you can set the width and height to x2 and change them to the required values after the camera is initialized (onInitialized). You may still have to change the camera position in onInitialized too.

Example:

const device = useCameraDevice(isInitialized || isIOS ? props.position : 'front');

This is a very nasty bug, but if you need to use this version, you can do as I indicated above

@gsagergithub
Copy link

As a workaround, you can set the width and height to x2 and change them to the required values after the camera is initialized (onInitialized). You may still have to change the camera position in onInitialized too.

Example:

const device = useCameraDevice(isInitialized || isIOS ? props.position : 'front');

This is a very nasty bug, but if you need to use this version, you can do as I indicated above

Same issue + sometimes onInitialized callback does not trigger :(

@iqorlobanov
Copy link

Same issue + sometimes onInitialized callback does not trigger :(

onInitialized fires only if isActive={true}

@iqorlobanov
Copy link

Same issue + sometimes onInitialized callback does not trigger :(

Share your latest code here

@gsagergithub
Copy link

Same issue + sometimes onInitialized callback does not trigger :(

Share your latest code here

Well, that explains my problem. I'm trying to set isActive inside onInitialized, that's what makes sense for me. Ty Igor!

@MateusAnderle
Copy link
Author

MateusAnderle commented Jan 9, 2024

const device = useCameraDevice(isInitialized || isIOS ? props.position : 'front');

This didn't work for me. The image is still opening stretched.

@iqorlobanov
Copy link

const device = useCameraDevice(isInitialized || isIOS ? props.position : 'front');

This didn't work for me. The image is still opening stretched.

Did you try to change width and height after initialization?

@mrousavy
Copy link
Owner

mrousavy commented Jan 9, 2024

Same issue + sometimes onInitialized callback does not trigger :(

onInitialized fires only if isActive={true}

Fixed in a8b85a3

@MateusAnderle
Copy link
Author

const device = useCameraDevice(isInitialized || isIOS ? props.position : 'front');

This didn't work for me. The image is still opening stretched.

Did you try to change width and height after initialization?

Works for me! It's not the ideal fix for the problem, but resolves my problem right now, thank you!

@CodeReset
Copy link

I'm experiencing strange behavior; it's also stretched horizontally for me. I'm trying to adjust the styles in onInitialized. If I set the width and height like this:

const {width, height} = useWindowDimensions();
<Camera
  style={
    isInitialized
      ? {
          width,
          height,
        }
      : StyleSheet.absoluteFill
  }
  // other camera properties
/>

It remains stretched, but if, for example, I do it like this:

<Camera
  style={
    isInitialized
      ? {
          width: width,
          height: height - 1,
        }
      : StyleSheet.absoluteFill
  }
  // other camera properties
/>

Then it looks normal, but obviously, this is not a solution.

@MateusAnderle
Copy link
Author

I'm experiencing strange behavior; it's also stretched horizontally for me. I'm trying to adjust the styles in onInitialized. If I set the width and height like this:

const {width, height} = useWindowDimensions();
<Camera
  style={
    isInitialized
      ? {
          width,
          height,
        }
      : StyleSheet.absoluteFill
  }
  // other camera properties
/>

It remains stretched, but if, for example, I do it like this:

<Camera
  style={
    isInitialized
      ? {
          width: width,
          height: height - 1,
        }
      : StyleSheet.absoluteFill
  }
  // other camera properties
/>

Then it looks normal, but obviously, this is not a solution.

I'm using flex: 0 and flex: 1. Works fine

@iqorlobanov
Copy link

I'm experiencing strange behavior; it's also stretched horizontally for me. I'm trying to adjust the styles in onInitialized. If I set the width and height like this:

const {width, height} = useWindowDimensions();
<Camera
  style={
    isInitialized
      ? {
          width,
          height,
        }
      : StyleSheet.absoluteFill
  }
  // other camera properties
/>

It remains stretched, but if, for example, I do it like this:

<Camera
  style={
    isInitialized
      ? {
          width: width,
          height: height - 1,
        }
      : StyleSheet.absoluteFill
  }
  // other camera properties
/>

Then it looks normal, but obviously, this is not a solution.

Try to use a larger value before initialization. Your solution works because you gave a smaller value of height after initialization

@mrousavy
Copy link
Owner

Hey!

After 8 hours of debugging, I finally found the culprit! I fixed the preview stretching issue in this PR: #2377

If you appreciate my dedication and free support, please consider 💖 sponsoring me on GitHub 💖 so I can keep providing fixes and building out new features for my open-source libraries in my free time.

@iaheck
Copy link

iaheck commented Jan 11, 2024

hey @mrousavy ! Thank you so much for everything you do and your fast responses. I've tried the version 3.7.1 and I think it still has this issue (at least on my Galaxy S10e). But version 3.6.16 works fine for what I'm doing so I think I'll stick to that for now. Maybe if more people try 3.7.1 and report if it's fixed for them? thank you folks!

@BarbieriMatheus
Copy link

BarbieriMatheus commented Jan 11, 2024

I tried the new version 3.7.1 with the fix but the issue still on OnePus 5T and Xiaomi Mi 9 L

@buitrbao222
Copy link

Still happening on v3.7.1, i'm using RN 0.72.4, Android 12, Redmi Note 5 Pro

@r1cs1
Copy link

r1cs1 commented Jan 12, 2024

Same issue for me. If I set isActive to true only when camera is initialized then it works for the first time I open the camera. Then it has the same issue when I unmount the camera and remount later in the app. Only workaround that worked is to set isActive true->false->true forcing a rerender on the camera preview fixes the stretch.

@snips11
Copy link

snips11 commented Jan 12, 2024

Still see the error on 3.7.1, it seems to work when the code scanner is being used but we also use another camera where it is not being used and it doesnt.

@mrousavy
Copy link
Owner

That's weird.
I can't reproduce the bug 🤷‍♂️

Can you try to move this line here up two lines:

(so outside of the UiThreadUtil thingy) and see if that fixes anything?

@iqorlobanov
Copy link

That's weird.

I can't reproduce the bug 🤷‍♂️

Try to set aspectRatio 4/3 for example and set width and height of camera based on aspect ratio

@alexrififi
Copy link

@mrousavy I tried your fix with holder, but unfortunately it did not solve the issue

@r1cs1
Copy link

r1cs1 commented Jan 13, 2024

I’ve also experienced that setting the width and height to match camera format ratio (4:3) the preview is zoomed in compared to the photo taken.

EDIT: it's forcing the preview content to be device screen ratio instead of format ratio @mrousavy

@mrousavy
Copy link
Owner

Are y'all using a format?

@r1cs1
Copy link

r1cs1 commented Jan 15, 2024

Are y'all using a format?

I do.

  const format = useCameraFormat(device, [
    { photoAspectRatio: 4 / 3 },
    { photoResolution: { width: 1280, height: 960 } },
    { photoHdr: true }
  ]);

@snips11
Copy link

snips11 commented Jan 15, 2024 via email

@snips11
Copy link

snips11 commented Jan 15, 2024 via email

@Menardi
Copy link
Contributor

Menardi commented Jan 15, 2024

@mrousavy Thanks for your great work on this plugin. I can reproduce this in the example app just by commenting out the video and frameProcessor props in CameraPage.tsx, and not changing anything else:

                photo={true}
                // video={true}
                audio={hasMicrophonePermission}
                // frameProcessor={frameProcessor}
              />

On a Pixel 7a running Android 14, when I open the example app from cold after making these changes, the preview is distorted, similar to the screenshot at the top of this issue.

Here's a short screencap showing the issue. It's probably not as clear from the video as it is in person, but you can see that the iPhone image on the react-native-vision-camera website is skewed and very narrow.

vision-camera.mp4

These are all the logs shown in yarn start:

 LOG  Running "VisionCameraExample" with {"rootTag":11}
 LOG  Loading react-native-worklets-core...
 LOG  Worklets loaded successfully
 LOG  Re-rendering Navigator. Camera: granted | Microphone: granted
 LOG  Camera: BACK (0) | Format: (4000x2000 photo / 2560x1280@30 video @ 30fps)
 LOG  Camera initialized!
 LOG  Camera initialized!

These are the adb logs for the example app:

com.mrousavy.camera.example adb logs
---------------------------- PROCESS STARTED (18066) for package com.mrousavy.camera.example ----------------------------
2024-01-15 11:45:51.215 18066-18066 ziparchive              com.mrousavy.camera.example          W  Unable to open '/data/app/~~pcCvV8YPAetep8R1KxCagg==/com.mrousavy.camera.example-2KnujtTMdU_bgooFgoXuOA==/base.dm': No such file or directory
2024-01-15 11:45:51.215 18066-18066 ziparchive              com.mrousavy.camera.example          W  Unable to open '/data/app/~~pcCvV8YPAetep8R1KxCagg==/com.mrousavy.camera.example-2KnujtTMdU_bgooFgoXuOA==/base.dm': No such file or directory
2024-01-15 11:45:51.348 18066-18066 nativeloader            com.mrousavy.camera.example          D  Configuring clns-4 for other apk /data/app/~~pcCvV8YPAetep8R1KxCagg==/com.mrousavy.camera.example-2KnujtTMdU_bgooFgoXuOA==/base.apk. target_sdk_version=33, uses_libraries=, library_path=/data/app/~~pcCvV8YPAetep8R1KxCagg==/com.mrousavy.camera.example-2KnujtTMdU_bgooFgoXuOA==/lib/arm64:/data/app/~~pcCvV8YPAetep8R1KxCagg==/com.mrousavy.camera.example-2KnujtTMdU_bgooFgoXuOA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.mrousavy.camera.example
2024-01-15 11:45:51.358 18066-18066 GraphicsEnvironment     com.mrousavy.camera.example          V  Currently set values for:
2024-01-15 11:45:51.359 18066-18066 GraphicsEnvironment     com.mrousavy.camera.example          V    angle_gl_driver_selection_pkgs=[]
2024-01-15 11:45:51.359 18066-18066 GraphicsEnvironment     com.mrousavy.camera.example          V    angle_gl_driver_selection_values=[]
2024-01-15 11:45:51.359 18066-18066 GraphicsEnvironment     com.mrousavy.camera.example          V  ANGLE GameManagerService for com.mrousavy.camera.example: false
2024-01-15 11:45:51.359 18066-18066 GraphicsEnvironment     com.mrousavy.camera.example          V  com.mrousavy.camera.example is not listed in per-application setting
2024-01-15 11:45:51.359 18066-18066 GraphicsEnvironment     com.mrousavy.camera.example          V  Neither updatable production driver nor prerelease driver is supported.
2024-01-15 11:45:51.362 18066-18066 FrameProce...inRegistry com.mrousavy.camera.example          I  Successfully registered Frame Processor Plugin "example_plugin"!
2024-01-15 11:45:51.362 18066-18066 FrameProce...inRegistry com.mrousavy.camera.example          I  Successfully registered Frame Processor Plugin "example_kotlin_swift_plugin"!
2024-01-15 11:45:51.376 18066-18066 SoLoader                com.mrousavy.camera.example          V  Init System Loader delegate
2024-01-15 11:45:51.384 18066-18089 vulkan                  com.mrousavy.camera.example          D  searching for layers in '/data/app/~~pcCvV8YPAetep8R1KxCagg==/com.mrousavy.camera.example-2KnujtTMdU_bgooFgoXuOA==/lib/arm64'
2024-01-15 11:45:51.384 18066-18089 vulkan                  com.mrousavy.camera.example          D  searching for layers in '/data/app/~~pcCvV8YPAetep8R1KxCagg==/com.mrousavy.camera.example-2KnujtTMdU_bgooFgoXuOA==/base.apk!/lib/arm64-v8a'
2024-01-15 11:45:51.418 18066-18066 unknown:Re...gerBuilder com.mrousavy.camera.example          W  You're not setting the JS Engine Resolution Algorithm. We'll try to load JSC first, and if it fails we'll fallback to Hermes
2024-01-15 11:45:51.500 18066-18117 TrafficStats            com.mrousavy.camera.example          D  tagSocket(87) with statsTag=0xffffffff, statsUid=-1
2024-01-15 11:45:51.500 18066-18118 TrafficStats            com.mrousavy.camera.example          D  tagSocket(89) with statsTag=0xffffffff, statsUid=-1
2024-01-15 11:45:51.500 18066-18116 TrafficStats            com.mrousavy.camera.example          D  tagSocket(90) with statsTag=0xffffffff, statsUid=-1
2024-01-15 11:45:51.509 18066-18066 .camera.example         com.mrousavy.camera.example          W  Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
2024-01-15 11:45:51.509 18066-18066 .camera.example         com.mrousavy.camera.example          W  Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
2024-01-15 11:45:51.525 18066-18066 Compatibil...geReporter com.mrousavy.camera.example          D  Compat change id reported: 237531167; UID 10337; state: DISABLED
2024-01-15 11:45:51.537 18066-18066 unknown:ReactNative     com.mrousavy.camera.example          W  Packager connection already open, nooping.
2024-01-15 11:45:51.557 18066-18066 Compatibil...geReporter com.mrousavy.camera.example          D  Compat change id reported: 210923482; UID 10337; state: ENABLED
2024-01-15 11:45:51.944 18066-18066 WindowOnBackDispatcher  com.mrousavy.camera.example          W  sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@751684d
2024-01-15 11:45:51.982 18066-18134 CameraManagerGlobal     com.mrousavy.camera.example          I  Connecting to camera service
2024-01-15 11:45:52.004 18066-18134 unknown:ReactContext    com.mrousavy.camera.example          W  initializeMessageQueueThreads() is called.
2024-01-15 11:45:52.016 18066-18066 unknown:ReactNative     com.mrousavy.camera.example          W  Packager connection already open, nooping.
2024-01-15 11:45:52.057 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.traceupdateoverlay.TraceUpdateOverlayManager
2024-01-15 11:45:52.064 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
2024-01-15 11:45:52.070 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
2024-01-15 11:45:52.073 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
2024-01-15 11:45:52.077 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
2024-01-15 11:45:52.079 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
2024-01-15 11:45:52.081 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
2024-01-15 11:45:52.083 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
2024-01-15 11:45:52.088 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
2024-01-15 11:45:52.091 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
2024-01-15 11:45:52.092 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
2024-01-15 11:45:52.094 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
2024-01-15 11:45:52.095 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
2024-01-15 11:45:52.097 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
2024-01-15 11:45:52.101 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
2024-01-15 11:45:52.103 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
2024-01-15 11:45:52.104 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
2024-01-15 11:45:52.104 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
2024-01-15 11:45:52.105 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
2024-01-15 11:45:52.111 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
2024-01-15 11:45:52.115 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
2024-01-15 11:45:52.118 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
2024-01-15 11:45:52.120 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
2024-01-15 11:45:52.125 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
2024-01-15 11:45:52.125 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
2024-01-15 11:45:52.127 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
2024-01-15 11:45:52.129 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.reactnativecommunity.blurview.BlurViewManager
2024-01-15 11:45:52.131 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.dylanvann.fastimage.FastImageViewManager
2024-01-15 11:45:52.133 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
2024-01-15 11:45:52.134 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
2024-01-15 11:45:52.136 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.th3rdwave.safeareacontext.SafeAreaProviderManager
2024-01-15 11:45:52.138 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.th3rdwave.safeareacontext.SafeAreaViewManager
2024-01-15 11:45:52.140 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.th3rdwave.safeareacontext.SafeAreaViewShadowNode
2024-01-15 11:45:52.141 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.rnscreens.ScreenContainerViewManager
2024-01-15 11:45:52.143 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.rnscreens.ScreenViewManager
2024-01-15 11:45:52.146 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.rnscreens.ScreenStackViewManager
2024-01-15 11:45:52.148 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.rnscreens.ScreenStackHeaderConfigViewManager
2024-01-15 11:45:52.151 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.rnscreens.ScreenStackHeaderSubviewManager
2024-01-15 11:45:52.152 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.rnscreens.SearchBarManager
2024-01-15 11:45:52.155 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.brentvatne.react.ReactVideoViewManager
2024-01-15 11:45:52.158 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.mrousavy.camera.CameraViewManager
2024-01-15 11:45:52.164 18066-18137 .camera.example         com.mrousavy.camera.example          W  Accessing hidden field Ljava/lang/reflect/Field;->accessFlags:I (unsupported, reflection, allowed)
2024-01-15 11:45:52.165 18066-18137 unknown:ReactContext    com.mrousavy.camera.example          W  initializeMessageQueueThreads() is called.
2024-01-15 11:45:52.188 18066-18137 CameraDevices           com.mrousavy.camera.example          I  Camera #0 is now available.
2024-01-15 11:45:52.188 18066-18137 CameraDevices           com.mrousavy.camera.example          I  Camera #1 is now available.
2024-01-15 11:45:52.258 18066-18137 ziparchive              com.mrousavy.camera.example          W  Unable to open '/data/app/~~quYI7OSktpJJRw5Rz6n6ig==/com.google.android.trichromelibrary_609919433-CEM6-lXUVegaXyqLULQSIg==/base.dm': No such file or directory
2024-01-15 11:45:52.258 18066-18137 ziparchive              com.mrousavy.camera.example          W  Unable to open '/data/app/~~quYI7OSktpJJRw5Rz6n6ig==/com.google.android.trichromelibrary_609919433-CEM6-lXUVegaXyqLULQSIg==/base.dm': No such file or directory
2024-01-15 11:45:52.259 18066-18137 .camera.example         com.mrousavy.camera.example          W  Entry not found
2024-01-15 11:45:52.261 18066-18137 nativeloader            com.mrousavy.camera.example          D  Configuring clns-5 for other apk /data/app/~~quYI7OSktpJJRw5Rz6n6ig==/com.google.android.trichromelibrary_609919433-CEM6-lXUVegaXyqLULQSIg==/base.apk. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~4PdUt-ng8HNv-R6Pm9GvUA==/com.google.android.webview-A3N8Gp0QkflDXLvdSWqI8w==/lib/arm64:/data/app/~~4PdUt-ng8HNv-R6Pm9GvUA==/com.google.android.webview-A3N8Gp0QkflDXLvdSWqI8w==/base.apk!/lib/arm64-v8a:/data/app/~~quYI7OSktpJJRw5Rz6n6ig==/com.google.android.trichromelibrary_609919433-CEM6-lXUVegaXyqLULQSIg==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
2024-01-15 11:45:52.261 18066-18137 nativeloader            com.mrousavy.camera.example          D  Extending system_exposed_libraries: libedgetpu_dba.google.so
2024-01-15 11:45:52.266 18066-18137 nativeloader            com.mrousavy.camera.example          D  Configuring clns-6 for other apk /data/app/~~4PdUt-ng8HNv-R6Pm9GvUA==/com.google.android.webview-A3N8Gp0QkflDXLvdSWqI8w==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~4PdUt-ng8HNv-R6Pm9GvUA==/com.google.android.webview-A3N8Gp0QkflDXLvdSWqI8w==/lib/arm64:/data/app/~~4PdUt-ng8HNv-R6Pm9GvUA==/com.google.android.webview-A3N8Gp0QkflDXLvdSWqI8w==/base.apk!/lib/arm64-v8a:/data/app/~~quYI7OSktpJJRw5Rz6n6ig==/com.google.android.trichromelibrary_609919433-CEM6-lXUVegaXyqLULQSIg==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
2024-01-15 11:45:52.272 18066-18137 WebViewFactory          com.mrousavy.camera.example          I  Loading com.google.android.webview version 120.0.6099.194 (code 609919433)
2024-01-15 11:45:52.283 18066-18137 cr_WVCFactoryProvider   com.mrousavy.camera.example          I  Loaded version=120.0.6099.194 minSdkVersion=29 isBundle=true multiprocess=true packageId=2
2024-01-15 11:45:52.296 18066-18145 chromium                com.mrousavy.camera.example          E  [0115/114552.295563:ERROR:variations_seed_loader.cc(69)] Failed to open file for reading. Errno: 2
2024-01-15 11:45:52.302 18066-18137 cr_LibraryLoader        com.mrousavy.camera.example          I  Successfully loaded native library
2024-01-15 11:45:52.303 18066-18137 cr_CachingUmaRecorder   com.mrousavy.camera.example          I  Flushed 7 samples from 7 histograms, 0 samples were dropped.
2024-01-15 11:45:52.317 18066-18148 TrafficStats            com.mrousavy.camera.example          D  tagSocket(128) with statsTag=0xffffffff, statsUid=-1
2024-01-15 11:45:52.385 18066-18136 ReactNativeJS           com.mrousavy.camera.example          I  Running "VisionCameraExample" with {"rootTag":11}
2024-01-15 11:45:52.389 18066-18149 TrafficStats            com.mrousavy.camera.example          D  tagSocket(128) with statsTag=0xffffffff, statsUid=-1
2024-01-15 11:45:52.559 18066-18136 ReactNativeJS           com.mrousavy.camera.example          I  Loading react-native-worklets-core...
2024-01-15 11:45:52.563 18066-18136 ReactNativeJS           com.mrousavy.camera.example          I  Worklets loaded successfully
2024-01-15 11:45:52.569 18066-18136 VisionCameraProxy       com.mrousavy.camera.example          I  Initializing VisionCameraProxy...
2024-01-15 11:45:52.569 18066-18136 VisionCameraProxy       com.mrousavy.camera.example          I  Creating Worklet Context...
2024-01-15 11:45:52.572 18066-18136 VisionCameraProxy       com.mrousavy.camera.example          I  Worklet Context created!
2024-01-15 11:45:52.577 18066-18136 ReactNativeJS           com.mrousavy.camera.example          I  Re-rendering Navigator. Camera: granted | Microphone: granted
2024-01-15 11:45:52.665 18066-18136 .camera.example         com.mrousavy.camera.example          W  CheckJNI: method to register "installJSIBindings" not in the given class. This is slow, consider changing your RegisterNatives calls.
2024-01-15 11:45:52.821 18066-18136 MMKV                    com.mrousavy.camera.example          I  Loading C++ library...
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  Installing MMKV JSI Bindings for MMKV root directory: /data/user/0/com.mrousavy.camera.example/files/mmkv
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MMKV.cpp:164::initialize> version v1.3.0, page size 4096, arch arm64-v8a
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MMKV.cpp:175::initialize> armv8 AES instructions is supported
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MMKV.cpp:183::initialize> armv8 CRC32 instructions is supported
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MMKV.cpp:207::initializeMMKV> root dir: /data/user/0/com.mrousavy.camera.example/files/mmkv
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  Successfully installed MMKV JSI Bindings!
2024-01-15 11:45:52.823 18066-18136 RNMMKV                  com.mrousavy.camera.example          I  Creating MMKV instance "mmkv.default"... (Path: , Encrypted: 0)
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MemoryFile.cpp:97::open> open fd[0x86], /data/user/0/com.mrousavy.camera.example/files/mmkv/mmkv.default
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MemoryFile.cpp:97::open> open fd[0x87], /data/user/0/com.mrousavy.camera.example/files/mmkv/mmkv.default.crc
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MMKV_IO.cpp:200::loadMetaInfoAndCheck> meta file [mmkv.default] has flag [0]
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MMKV_IO.cpp:78::loadFromFile> loading [mmkv.default] with 0 actual size, file size 4096, InterProcess 0, meta info version:4
2024-01-15 11:45:52.823 18066-18136 MMKV                    com.mrousavy.camera.example          I  <MMKV_IO.cpp:127::loadFromFile> loaded [mmkv.default] with 0 key-values
2024-01-15 11:45:52.836 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy package: com.google.android.apps.camera.services
2024-01-15 11:45:52.836 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy service: com.google.android.apps.camera.services.extensions.service.PixelExtensions
2024-01-15 11:45:52.857 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy package: com.google.android.apps.camera.services
2024-01-15 11:45:52.857 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy service: com.google.android.apps.camera.services.extensions.service.PixelExtensions
2024-01-15 11:45:52.883 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy package: com.google.android.apps.camera.services
2024-01-15 11:45:52.883 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy service: com.google.android.apps.camera.services.extensions.service.PixelExtensions
2024-01-15 11:45:52.905 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy package: com.google.android.apps.camera.services
2024-01-15 11:45:52.905 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy service: com.google.android.apps.camera.services.extensions.service.PixelExtensions
2024-01-15 11:45:52.927 18066-18136 Compatibil...geReporter com.mrousavy.camera.example          D  Compat change id reported: 206033068; UID 10337; state: ENABLED
2024-01-15 11:45:53.017 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy package: com.google.android.apps.camera.services
2024-01-15 11:45:53.017 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy service: com.google.android.apps.camera.services.extensions.service.PixelExtensions
2024-01-15 11:45:53.044 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy package: com.google.android.apps.camera.services
2024-01-15 11:45:53.044 18066-18136 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy service: com.google.android.apps.camera.services.extensions.service.PixelExtensions
2024-01-15 11:45:53.419 18066-18136 FrameProce...inRegistry com.mrousavy.camera.example          I  Looking up Frame Processor Plugin "example_plugin"...
2024-01-15 11:45:53.419 18066-18136 FrameProce...inRegistry com.mrousavy.camera.example          I  Frame Processor Plugin "example_plugin" found! Initializing...
2024-01-15 11:45:53.419 18066-18136 SharedArray             com.mrousavy.camera.example          I  Allocating ArrayBuffer with size 5 and type 3...
2024-01-15 11:45:53.419 18066-18136 SharedArray             com.mrousavy.camera.example          I  Wrapping ArrayBuffer in a JNI ByteBuffer...
2024-01-15 11:45:53.419 18066-18136 SharedArray             com.mrousavy.camera.example          I  Successfully created TypedArray (JNI Size: 5)!
2024-01-15 11:45:53.419 18066-18136 ExamplePlugin           com.mrousavy.camera.example          D  ExampleFrameProcessorPlugin initialized with options: {}
2024-01-15 11:45:53.420 18066-18136 FrameProce...inRegistry com.mrousavy.camera.example          I  Looking up Frame Processor Plugin "example_kotlin_swift_plugin"...
2024-01-15 11:45:53.420 18066-18136 FrameProce...inRegistry com.mrousavy.camera.example          I  Frame Processor Plugin "example_kotlin_swift_plugin" found! Initializing...
2024-01-15 11:45:53.420 18066-18136 ExampleKotlinPlugin     com.mrousavy.camera.example          D  ExampleKotlinFrameProcessorPlugin initialized with options: {foo=bar}
2024-01-15 11:45:53.485 18066-18066 PreviewView             com.mrousavy.camera.example          I  Creating PreviewView...
2024-01-15 11:45:53.486 18066-18066 PreviewView             com.mrousavy.camera.example          I  PreviewView is 0x0, rendering 1080x1920 content. Resizing to: 0x0 (COVER)
2024-01-15 11:45:53.492 18066-18066 CameraView              com.mrousavy.camera.example          I  Updating CameraSession...
2024-01-15 11:45:53.500 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Waiting for lock...
2024-01-15 11:45:53.506 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-01-15 11:45:53.506 18066-18155 CameraSession           com.mrousavy.camera.example          I  Need to rebuild CameraDevice and CameraCaptureSession...
2024-01-15 11:45:53.506 18066-18155 CameraSession           com.mrousavy.camera.example          I  CameraDevice and CameraCaptureSession is torn down but Camera is not active, skipping update...
2024-01-15 11:45:53.506 18066-18155 CameraSession           com.mrousavy.camera.example          I  Successfully updated CameraSession Configuration! isActive: false
2024-01-15 11:45:53.507 18066-18155 CameraView              com.mrousavy.camera.example          I  invokeOnInitialized()
2024-01-15 11:45:53.537 18066-18137 unknown:Vi...rtyUpdater com.mrousavy.camera.example          W  Could not find generated setter for class com.swmansion.rnscreens.ScreensShadowNode
2024-01-15 11:45:53.577 18066-18136 ReactNativeJS           com.mrousavy.camera.example          I  Camera: BACK (0) | Format: (4000x2000 photo / 2560x1280@30 video @ 30fps)
2024-01-15 11:45:53.608 18066-18136 ReactNativeJS           com.mrousavy.camera.example          I  Camera initialized!
2024-01-15 11:45:53.611 18066-18137 Compatibil...geReporter com.mrousavy.camera.example          D  Compat change id reported: 289878283; UID 10337; state: DISABLED
2024-01-15 11:45:53.641 18066-18066 ReactNative             com.mrousavy.camera.example          I  [GESTURE HANDLER] Initialize gesture handler for root view com.facebook.react.ReactRootView{2c4c9e V.E...... ......ID 0,0-1080,2337 #b}
2024-01-15 11:45:53.657 18066-18066 CameraView              com.mrousavy.camera.example          I  Updating CameraSession...
2024-01-15 11:45:53.657 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Waiting for lock...
2024-01-15 11:45:53.659 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-01-15 11:45:53.659 18066-18155 CameraSession           com.mrousavy.camera.example          I  Need to rebuild CameraDevice and CameraCaptureSession...
2024-01-15 11:45:53.659 18066-18155 CameraSession           com.mrousavy.camera.example          I  Need to rebuild CameraDevice and CameraCaptureSession...
2024-01-15 11:45:53.659 18066-18155 CameraSession           com.mrousavy.camera.example          I  Configuring Camera #0...
2024-01-15 11:45:53.666 18066-18155 CameraManager           com.mrousavy.camera.example          I  Camera #0: Opening...
2024-01-15 11:45:53.678 18066-18066 PreviewView             com.mrousavy.camera.example          I  PreviewView is 1080x2337, rendering 1080x1920 content. Resizing to: 1315x2337 (COVER)
2024-01-15 11:45:53.699 18066-18066 CameraSession           com.mrousavy.camera.example          I  PreviewView Surface created! Surface(name=null)/@0x1ad809a
2024-01-15 11:45:53.699 18066-18066 CameraSession           com.mrousavy.camera.example          I  Setting Preview Output...
2024-01-15 11:45:53.699 18066-18066 CameraSession           com.mrousavy.camera.example          I  PreviewView Surface updated! Surface(name=null)/@0x1ad809a 1315 x 2337
2024-01-15 11:45:53.712 18066-18066 CameraView              com.mrousavy.camera.example          I  Updating CameraSession...
2024-01-15 11:45:53.718 18066-18137 CameraDevices           com.mrousavy.camera.example          I  Camera #0 is now unavailable.
2024-01-15 11:45:53.722 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Waiting for lock...
2024-01-15 11:45:53.723 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Waiting for lock...
2024-01-15 11:45:53.723 18066-18155 CameraManager           com.mrousavy.camera.example          I  Camera #0: Opened!
2024-01-15 11:45:53.730 18066-18155 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy package: com.google.android.apps.camera.services
2024-01-15 11:45:53.730 18066-18155 CameraExte...agerGlobal com.mrousavy.camera.example          V  Choosing the vendor camera extensions proxy service: com.google.android.apps.camera.services.extensions.service.PixelExtensions
2024-01-15 11:45:53.746 18066-18155 CameraSession           com.mrousavy.camera.example          I  Successfully configured Camera #0!
2024-01-15 11:45:53.746 18066-18155 CameraSession           com.mrousavy.camera.example          I  Destroying previous outputs...
2024-01-15 11:45:53.747 18066-18155 CameraSession           com.mrousavy.camera.example          I  Creating outputs for Camera #0...
2024-01-15 11:45:53.750 18066-18155 CameraSession           com.mrousavy.camera.example          I  Adding 4000x2000 Photo Output in JPEG...
2024-01-15 11:45:53.750 18066-18155 Compatibil...geReporter com.mrousavy.camera.example          D  Compat change id reported: 236825255; UID 10337; state: DISABLED
2024-01-15 11:45:53.753 18066-18155 CreateCaptureSession    com.mrousavy.camera.example          I  Camera #0: Creating Capture Session #1... (Hardware Level: 1 | Outputs: [PHOTO (4000x2000 in JPEG)])
2024-01-15 11:45:53.753 18066-18155 SurfaceOutput           com.mrousavy.camera.example          I  Using optimized stream use case 2 for PHOTO output.
2024-01-15 11:45:53.754 18066-18155 CreateCaptureSession    com.mrousavy.camera.example          I  Using new API (>=28)
2024-01-15 11:45:53.814 18066-18155 CreateCaptureSession    com.mrousavy.camera.example          I  Camera #0: Successfully created CameraCaptureSession #1!
2024-01-15 11:45:53.814 18066-18155 CameraSession           com.mrousavy.camera.example          I  Successfully configured Session with 1 outputs for Camera #0!
2024-01-15 11:45:53.814 18066-18155 CameraSession           com.mrousavy.camera.example          I  CameraSession has no repeating outputs (Preview, Video, CodeScanner), skipping CaptureRequest...
2024-01-15 11:45:53.814 18066-18155 CameraSession           com.mrousavy.camera.example          I  Successfully updated CameraSession Configuration! isActive: true
2024-01-15 11:45:53.814 18066-18155 CameraView              com.mrousavy.camera.example          I  invokeOnInitialized()
2024-01-15 11:45:53.815 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=true, sidePropsChanged=true, isActiveChanged=false)
2024-01-15 11:45:53.815 18066-18136 ReactNativeJS           com.mrousavy.camera.example          I  Camera initialized!
2024-01-15 11:45:53.815 18066-18155 CameraSession           com.mrousavy.camera.example          I  Destroying previous outputs...
2024-01-15 11:45:53.815 18066-18155 SurfaceOutput           com.mrousavy.camera.example          I  Closing 4000x2000 PHOTO ImageReader..
2024-01-15 11:45:53.817 18066-18155 CameraSession           com.mrousavy.camera.example          I  Creating outputs for Camera #0...
2024-01-15 11:45:53.821 18066-18155 CameraSession           com.mrousavy.camera.example          I  Adding 4000x2000 Photo Output in JPEG...
2024-01-15 11:45:53.825 18066-18155 CameraSession           com.mrousavy.camera.example          I  Adding 1920x1080 Preview Output...
2024-01-15 11:45:53.825 18066-18066 PreviewView             com.mrousavy.camera.example          I  Setting PreviewView Surface Size to 1315 x 2337...
2024-01-15 11:45:53.827 18066-18155 CreateCaptureSession    com.mrousavy.camera.example          I  Camera #0: Creating Capture Session #2... (Hardware Level: 1 | Outputs: [PHOTO (4000x2000 in JPEG), PREVIEW (1920 x 1080)])
2024-01-15 11:45:53.827 18066-18155 SurfaceOutput           com.mrousavy.camera.example          I  Using optimized stream use case 2 for PHOTO output.
2024-01-15 11:45:53.827 18066-18155 SurfaceOutput           com.mrousavy.camera.example          I  Using optimized stream use case 1 for PREVIEW output.
2024-01-15 11:45:53.827 18066-18155 CreateCaptureSession    com.mrousavy.camera.example          I  Using new API (>=28)
2024-01-15 11:45:53.842 18066-18066 CameraSession           com.mrousavy.camera.example          I  PreviewView Surface updated! Surface(name=null)/@0x1ad809a 1920 x 1080
2024-01-15 11:45:53.935 18066-18082 BpBinder                com.mrousavy.camera.example          I  onLastStrongRef automatically unlinking death recipients: 
2024-01-15 11:45:53.936 18066-18155 CreateCaptureSession    com.mrousavy.camera.example          I  Camera #0: Successfully created CameraCaptureSession #2!
2024-01-15 11:45:53.936 18066-18155 CreateCaptureSession    com.mrousavy.camera.example          I  Camera #0: CameraCaptureSession #1 has been closed.
2024-01-15 11:45:53.936 18066-18155 CameraSession           com.mrousavy.camera.example          I  Camera Session android.hardware.camera2.impl.CameraCaptureSessionImpl@2c4d5c0 has been closed.
2024-01-15 11:45:53.936 18066-18155 CameraSession           com.mrousavy.camera.example          I  Successfully configured Session with 2 outputs for Camera #0!
2024-01-15 11:45:53.943 18066-18155 CameraView              com.mrousavy.camera.example          I  invokeOnStarted()
2024-01-15 11:45:53.944 18066-18155 CameraSession           com.mrousavy.camera.example          I  Successfully updated CameraSession Configuration! isActive: true
2024-01-15 11:45:53.947 18066-18155 CameraSession           com.mrousavy.camera.example          I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=false, sidePropsChanged=true, isActiveChanged=false)
2024-01-15 11:45:53.963 18066-18155 CameraSession           com.mrousavy.camera.example          I  Successfully updated CameraSession Configuration! isActive: true

If you need me to do any specific debugging, or would prefer I open a new issue, do let me know. Thanks!

@mrousavy
Copy link
Owner

Thanks, will try to investigate this!

@yvessidina
Copy link

Hi !
@mrousavy, thanks for this great plugin.

I have reproduced "stretched camera image" on Android on version 3.7.1.
I have tested on :

  • SamSung M13 - Android 13
  • OnePlus T8 - Android 13
  • SamSung S10+ - Android 12
  • Pixel 7 - Android 13

"stretched camera image" is just on the screen, and when I take a photo, the output was normal (no stretch on the output photo)

On iOS, all thing is Ok.

this is my instance (I use Back Camera).

<Reanimated.View style={streamViewPhoto}>
        <PanGestureHandler enabled={isFocussed}>
            <Camera
                key={"CameraViewer"}
                enableHighQualityPhotos={true}
                style={streamViewPhoto}
                pixelFormat="native"
                resizeMode="contain"
                ref={camera}
                device={device}
                isActive={isFocussed}
                format={format}
                accessibilityViewIsModal={true}
                photo={true}
                fps={fps}
                focusable={true}
                hdr={hdr}
            />
        </PanGestureHandler>
</Reanimated.View> 

Hope it will help you to investigate
best regard

@mrousavy
Copy link
Owner

I'd need the adb logcat logs to get more insights but I think I already know how to fix it

@yvessidina
Copy link

Hi @mrousavy here is a part of logcat.
Hope it will help you
logcat_debug.log

@maksimLobachevskiy
Copy link

This behavior is also reproduced on Android with the latest 3.8.0 release. But when I switch to front camera then back to Back camera, the image looks good.

@Jigar2311
Copy link

Hello, i am trying to make landscape recording using orientation locker to lock camera view as landscape but the camera view not perfectly looking .

i have attached camera video screenshot here
Can you please look into it.

landscapeCamera

@mrousavy
Copy link
Owner

Hey - orientation is not yet supported. See #1891

@Jigar2311
Copy link

I was using version 2.16.7, which was functioning well in all orientations. However, with the new version, I am encountering issues. Is there an estimate of how long it will take to resolve this issue and make it work again?

@mrousavy
Copy link
Owner

Read the discussion in #1891, that'll answer your questions.

@olegmilan
Copy link

Same issue for me. If I set isActive to true only when camera is initialized then it works for the first time I open the camera. Then it has the same issue when I unmount the camera and remount later in the app. Only workaround that worked is to set isActive true->false->true forcing a rerender on the camera preview fixes the stretch.

Same here. Also there's another workaround:
until onInitialised callback is called, pass some format==undefined.
And once camera is initialised just pass a proper format and code looks like this(this code also contains some other UI fixes. I tried to avoid changes to native code with patches):

    const device = getCameraDevice('back');
    const format = getCameraFormat(device, [
      { photoResolution: { width: 1280, height: 720 } },
      { videoResolution: { width: 1280, height: 720 } },
    ]);

    const aspectRatio = format ? format.photoHeight / format.photoWidth : 3 / 4;
    const paddingVertical = (Utils.device.screenHeight() - Utils.device.screenWidth() / aspectRatio) / 2;

    // on iOS we don't need that flag
    const isCameraInitialized = isIOS || this.isCameraInitialized;

    // PaddingVertical works properly, when add extra View layer(View -> View -> Camera)
    return (
      <View style={{ flex: 1, paddingVertical }}>
        <View style={{ flex: 1 }}>
          <VisionCamera
            ref={(ref) => { this.camera = ref; }}
            photo
            format={isAndroid && !this.isCameraInitialized ? undefined : format}
            resizeMode={'contain'}
            style={{ aspectRatio }}
            isActive={isCameraVisibleProp && format !== undefined}
            device={device}
            onInitialized={() => {
              // we need to call this mechanism only on initial launch for Android
              if (isIOS || this.isCameraInitialized) {
                return;
              }

              // better use requestAnimationFrame, since updating state immediately doesn't always fixes the issue
              requestAnimationFrame(() => {
                this.isCameraInitialized = true;
                // refresh state to show the camera
                this.setState({});
              });
            }}
          />
        </View>
      </View>
    );

@Menardi
Copy link
Contributor

Menardi commented Feb 5, 2024

Fyi for anyone else following this, it seems this might be a duplicate of #2142. There's some more discussion there, including some potential workarounds.

@mrousavy
Copy link
Owner

mrousavy commented Feb 5, 2024

yup 👍

@mrousavy
Copy link
Owner

mrousavy commented Feb 6, 2024

Created a PR to fix this issue once and for all: #2519 💪🚀
Thanks to everyone who sponsored me on GitHub to fix this bug!! 💖

Try the PR and see if it works (by checking out that branch and running the example app)

@den1a
Copy link

den1a commented Mar 7, 2024

Hi @mrousavy . I downloaded version 3.9.1 and the problem persists

qr1

code

@alexrififi
Copy link

I confirm the problem.
Device Poco c40, Android 11

@sberkeo
Copy link

sberkeo commented Mar 8, 2024

I am reporting from version 3.8.2, samsung galaxy a70, the problem continues, the latest versions crash the application for a reason I do not understand.

@erenkulaksiz
Copy link

I think i have a temporary solution to this.

Make a state called ìsInitialized:

const [isInitialized, setIsInitialized] = useState<boolean>(false);

Put this prop to <Camera />:

<Camera
  onInitialized={() => {
    setIsInitialized(true);
  }}
  {...yourProps}
/>

Now, we need to update style prop whenever isInitialized changes.
I did this to fix the issue:

<Camera
  style={
    isInitialized
      ? {
          position: "absolute",
          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
        }
      : {
          width: 0,
          height: 0,
        }
   }
   {...yourProps}
/>

Spent my 4 hours debugging this so you dont have to. Dont forget, it is temporary solution and this needs to be fixed.

@sberkeo
Copy link

sberkeo commented Mar 11, 2024

Thank you for your solution, it really solve it temporarily, but when you try to open the camera with fast login on slow devices or in unexpected situations, the preview still stretched. Even if I tried a little with the module codes, I saw that it was solved in the latest version. I recommend you to use the 4.0.0-beta.5 version.

@den1a
Copy link

den1a commented Mar 11, 2024

Thank you for your solution, it really solve it temporarily, but when you try to open the camera with fast login on slow devices or in unexpected situations, the preview still stretched. Even if I tried a little with the module codes, I saw that it was solved in the latest version. I recommend you to use the 4.0.0-beta.5 version.

My camera doesn't open at all on version 4.0.0-beta.5

ERROR Camera.onError(session/invalid-output-configuration): Failed to configure the Camera Session because the output/stream configurations are invalid! [session/invalid-output-configuration: Failed to co nfigure the Camera Session because the output/stream configurations are invalid!]

@mrousavy
Copy link
Owner

V4 is not meant for the public yet, that's why it's a beta and not even merged to main.

@RaresM7373
Copy link

So is the camera stretching issue on Android fixed in 4.x ? I am using 4.0.1 and still see the same issue? Thanks

austinbh1003 pushed a commit to austinbh1003/vision-camera that referenced this issue Jul 11, 2024
max71126 added a commit to max71126/react-native-vision-camera that referenced this issue Sep 19, 2024
Hantex9 added a commit to pagopa/io-app that referenced this issue Oct 11, 2024
…ion `4.3.1` (#6216)

## Short description
This PR upgrades the `react-native-vision-camera` version to the
v.`4.3.1` that fixes two of the bugs that are also reported in their
issues.
1. [IOBP-879] The Camera is working fine on most devices. However, there
are a few on which it just won't work. The camera will simply try to
load and stay black.
(mrousavy/react-native-vision-camera#2716)
2. [IOBP-880] On some devices the camera image appears horizontally
stretched
(mrousavy/react-native-vision-camera#2364)

## How to test
- Please test this PR on a real device to check that the camera is
working correctly from the Scan section tab bar.


[IOBP-879]:
https://pagopa.atlassian.net/browse/IOBP-879?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[IOBP-880]:
https://pagopa.atlassian.net/browse/IOBP-880?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Fabio Bombardi <[email protected]>
isaaccolson pushed a commit to isaaccolson/deliveries-mobile that referenced this issue Oct 30, 2024
@SUBTAIN-ALI
Copy link

I resolve this issue on Android devices using a specific combination of approaches. I'm unsure if it will work for you, but I have confirmed it on two different projects.

for React Native 0.71.0 and also make sure this
"react-native-reanimated": "3.6.1",

"react-native": "0.71.0",
"react-native-reanimated": "3.6.1",
"react-native-vision-camera": "3.6.4",

Initialize the camera devices

 const [selectedCamera, setSelectedCamera] = useState('front');
  const device = useCameraDevice(selectedCamera, {
    physicalDevices: [
      'ultra-wide-angle-camera',
      'wide-angle-camera',
      'telephoto-camera',
    ],
  });

set the format of the video or pitcher

const camera = useRef(null);
const isFocused = useIsFocused();

const format = useCameraFormat(device, [
  {videoResolution: {width: 1280, height: 720}},
  {fps: 30},
]);

{device && (
        <Camera
          ref={camera}
          style={StyleSheet.absoluteFill}
          device={device}
          isActive={isFocused}
          video={true}
          audio={true}
          photo={false}
          enableZoomGesture={true}
          format={format}
          onError={onError}
        />
      )}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests