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

🐛 MinZoom Problem in some devices (0,5) #3345

Open
4 of 5 tasks
dorakadri opened this issue Dec 31, 2024 · 2 comments
Open
4 of 5 tasks

🐛 MinZoom Problem in some devices (0,5) #3345

dorakadri opened this issue Dec 31, 2024 · 2 comments
Labels
🐛 bug Something isn't working

Comments

@dorakadri
Copy link

What's happening?

in some devices the min zoom is always 1 even tho its supposed to be 0,5 and that the physical device shows as ultra wide range

Reproduceable Code

const devices = Camera.getAvailableCameraDevices()

  const device = getCameraDevice(devices, 'back', {
    physicalDevices: ['ultra-wide-angle-camera', 'wide-angle-camera', 'telephoto-camera']
  })
  const zoom = useSharedValue(device?.neutralZoom)
  const format = useCameraFormat(device, Templates.Snapchat)
  const zoomOffset = useSharedValue(0)
  const [zoomState, setZoomState] = useState(device?.neutralZoom || 1)


  console.log()
  useDerivedValue(() => {
    if (!zoom.value) return
    runOnJS(setZoomState)(zoom.value)
    return zoom.value
  }, [zoom.value])
  const gesture = Gesture.Pinch()
    .onBegin(() => {
      if (zoom.value) {
        zoomOffset.value = zoom.value
      }
    })
    .onUpdate(event => {
      const z = zoomOffset.value * event.scale
      if (device) {
        zoom.value = interpolate(z, [1, 10], [device.minZoom, device.maxZoom], Extrapolation.CLAMP)
      }
    })



<ReanimatedCamera
          ref={cameraRef}
          outputOrientation='preview'
          style={isInitialized ? StyleSheet.absoluteFill : styles.noSize}
          onTouchEnd={focus}
          onShutter={playShutterSound}
          device={device}
          isActive={isActive}
          format={format}
          animatedProps={animatedProps}
          photo
          onError={console.warn}
          onLayout={event => {
            const { layout } = event.nativeEvent
            setCameraLayout(layout)
          }}
          onInitialized={() => {
            setTimeout(() => {
              if (
                device.physicalDevices.includes('ultra-wide-angle-camera') ||
                  device.physicalDevices.includes('wide-angle-camera') ||
                  device.physicalDevices.includes('telephoto-camera')
              ) {
                setWideRangeAvailable(true)
              }
              setIsInitialized(true)
            }, 10)
          }}

Relevant log output

no relevant log only the json ill show before

Camera Device

{
  "id": "2",
  "devices": [
    "ultra-wide-angle-camera"
  ],
  "formats": [{...},{...},{...},{...},{...},{...},{...},{...},{...},{...},{...},{...},{...},{...},{...},],
  "hardwareLevel": "limited",
  "hasFlash": false,
  "hasTorch": false,
  "isMultiCam": false,
  "minZoom": 1,
  "neutralZoom": 1,
  "maxZoom": 8,
  "name": " 2 (BACK) androidx.camera.camera2",
  "position": "back",
  "supportsFocus": true,
  "supportsLowLightBoost": false,
  "supportsRawCapture": false
}

Device

Samsung Galaxy a73 5g

VisionCamera Version

4.5.1 / 4.6.1

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

@dorakadri dorakadri added the 🐛 bug Something isn't working label Dec 31, 2024
Copy link

Guten Tag, Hans here! 🍻

Thank you for providing detailed information about ze issue with ze min zoom setting. It seems like you might be facing a valid bug, but we need more information to help mrousavy troubleshoot ze problem effectively.

Could you please provide some relevant logs from ze device? For Android, you can gather logs using adb logcat while replicating ze issue. This will help us understand what is happening internally.

Also, if you find ze project helpful, consider sponsoring mrousavy here to help keep ze development going!

Looking forward to your response!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

@wadiasalem
Copy link

I have the same issue

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

2 participants