* fix: Incorrect zoom on Android < 11
Fixes#1865
* Clamp zoom on Android
Some unclamped zoom values crash. For example, zoom={0.5} crashes
(tested on Android 9).
* Extract zoom into an extension (Android)
* Update package/android/src/main/java/com/mrousavy/camera/extensions/CaptureRequest+setZoom.kt
---------
Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>
* feat: New array-based `useCameraFormats` API
* Use triple-camera in Example app
* fix: Remove invalid export
* fix: Use constant-time lookup Filter map and only run sort once
* feat: Implement `resizeMode` prop for iOS
- `"cover"`: Keep aspect ratio, but fill entire parent view (centered).
- `"contain"`: Keep aspect ratio, but make sure the entire content is visible even if it introduces additional blank areas (centered).
* chore: Update prop docs
* Update CameraProps.ts
* Lint & Format
* feat(preview): respect format's aspect ratio
* fix: code guidelines and previewSize in PreviewView
* feat: add resizeMode 'cover' and 'contain' on Android
1. Reverts 4e96eb77e0 (PR #1789) to bring the C++ OpenGL GPU Pipeline back.
2. Fixes the "initHybrid JNI not found" error by loading the native JNI/C++ library in `VideoPipeline.kt`.
This PR has two downsides:
1. `pixelFormat="yuv"` does not work on Android. OpenGL only works in RGB
2. OpenGL rendering is fast, but it has an overhead. I think for Camera -> Video Recording we shouldn't be using an entire OpenGL rendering pipeline.
The original plan was to use something similar to how it works on iOS by just passing GPU buffers around, but the android.media APIs just aren't as advanced yet. `ImageReader`/`ImageWriter` is way too buggy and doesn't really work with `MediaRecorder`/`MediaCodec`.
This sucks, I hope in the future we can use something like `AHardwareBuffer`s.
* feat: Add support for LiDAR, TrueDepth, External (USB) and Continuity Camera Devices (iOS 17)
* Rename `devices` -> `physicalDevices`
* fix: Comment out iOS 17 cameras for now
* fix: Move `supportsDepthCapture` to `format`
* fix: Fall back to `wide-angle-camera` for any unknown types
* Update CameraPage.tsx
* `descriptor` -> `physicalDeviceDescriptor`
* Update CameraDevice.ts
* Format
* feat: Expose `userPreferredCameraDevice`
Uses the new iOS 17 API where the user can prefer a default device, otherwise fall back to the first device of the available ones
* fix: Expose as property
* Add TODO comments
* fix: Format code
* fix: Compile below Swift 5.9
<!--
❤️ Thank you for your contribution! ❤️
Make sure you have read the Contributing Guidelines:
https://github.com/mrousavy/react-native-vision-camera/blob/main/CONTRIBUTING.md
-->
## What
<!--
Enter a short description on what this pull-request does.
Examples:
This PR adds support for the HEVC format.
This PR fixes a "unsupported device" error on iPhone 8 and below.
This PR fixes a typo in a CameraError.
This PR adds support for Quadruple Cameras.
-->
## Changes
<!--
Create a short list of logic-changes.
Examples:
* This PR changes the default value of X to Y.
* This PR changes the configure() function to cache results.
-->
## Tested on
<!--
Create a short list of devices and operating-systems you have tested
this change on. (And verified that everything works as expected).
Examples:
* iPhone 11 Pro, iOS 14.3
* Huawai P20, Android 10
-->
## Related issues
<!--
Link related issues here.
Examples:
* Fixes#29
* Closes#30
* Resolves#5
-->