Commit Graph

328 Commits

Author SHA1 Message Date
Marc Rousavy
ffd64feee8 feat: Add enableCodeScanner to Expo Config Plugin 2023-10-05 11:06:38 +02:00
Jakov Glavina
6e249d165a
feat: Add Expo Config Plugin for CodeScanner MLKit Barcode Model downloader (#1916) 2023-10-05 10:58:31 +02:00
Marc Rousavy
59699929f4 fix: Use minSdkVersion of 26 again 2023-10-05 10:56:30 +02:00
Marc Rousavy
c9795ce767
fix: Fix clean build error (#1924)
Fixes https://github.com/mrousavy/react-native-vision-camera/issues/1915
2023-10-05 10:46:33 +02:00
Marc Rousavy
3ed74e6794 chore: release 3.3.0 2023-10-04 13:02:41 +02:00
Marc Rousavy
93019c37e6 docs: Update example 2023-10-04 13:00:23 +02:00
Marc Rousavy
5efaefee98 docs: Update QR Code references 2023-10-04 12:56:47 +02:00
Marc Rousavy
6640b72a00
feat: Code Scanner API (#1912)
* feat: CodeScanner JS API

* feat: iOS

* Use guard

* Format

* feat: Android base

* fix: Attach Surfaces

* Use isBusy var

* fix: Use separate Queue

* feat: Finish iOS types

* feat: Implement all other code types on Android

* fix: Call JS event

* fix: Pass codetypes on Android

* fix: iOS use Preview coordinate system

* docs: Add comments

* chore: Format code

* Update CameraView+AVCaptureSession.swift

* docs: Add Code Scanner docs

* docs: Update

* feat: Use lazily downloaded model on Android

* Revert changes in CameraPage

* Format

* fix: Fix empty QR codes

* Update README.md
2023-10-04 12:53:52 +02:00
Marc Rousavy
2c08e5ae78 fix: Also clean VisionCamera build cache 2023-10-04 11:11:12 +02:00
Marc Rousavy
4fc8cd2e01 fix: Clean C++ CMake cache (.cxx/) on clean 2023-10-04 11:06:39 +02:00
Marc Rousavy
9a777ba240 fix: Only use supported PixelFormats 2023-10-03 14:05:23 +02:00
Marc Rousavy
224bffd4dc fix: Use dynamic video format 2023-10-03 13:59:19 +02:00
Marc Rousavy
324e269173
fix: Set minSdkVersion to 23 (#1911)
* fix: Set `minSdkVersion` to 21

* sorry I meant 23
2023-10-03 13:52:42 +02:00
Marc Rousavy
8d90dcc476
fix: Make HardwareBuffers compile optionally (opt-out in minSdkVersion <26) (#1910)
* fix: Make HardwareBuffers compile optionally

* chore: Format C++ code

* fix: Fix if
2023-10-03 13:18:41 +02:00
Marc Rousavy
83c0cdb030
fix: Fix CamcorderProfile get crash on Samsung devices (#1907) 2023-10-03 12:04:03 +02:00
Marc Rousavy
1cdc3d1d9c
fix: Fix +load not available in Xcode 15 error (#1908) 2023-10-03 12:03:29 +02:00
Marc Rousavy
24f77fb224
fix: Use simple wide-angle device if no options are passed (#1909) 2023-10-03 12:03:20 +02:00
Mateusz Mędrek
62e786ad04
docs: Add Kotlin & Swift FP plugins examples (#1902)
* chore(docs): add Kotlin FP example

* chore(docs): add Swift FP plugin
2023-10-03 11:33:48 +02:00
Marc Rousavy
d465c37bea fix: Remove dng PixelFormat 2023-10-03 11:27:46 +02:00
Marc Rousavy
68776f683b chore: Type examplePlugin 2023-09-30 13:35:04 +02:00
Marc Rousavy
b92960a837 chore: Use max zoom of 10 in example 2023-09-30 13:23:17 +02:00
Marc Rousavy
be3d802267 chore: Remove unused ImageWriter 2023-09-30 13:01:56 +02:00
Marc Rousavy
af2ef57951 chore: release 3.2.2 2023-09-30 11:23:05 +02:00
Marc Rousavy
edd73619c3 fix: Fix useCameraDevices ignoring position 2023-09-30 11:20:11 +02:00
Marc Rousavy
844759e5b1 Update Podfile.lock 2023-09-30 11:17:27 +02:00
Marc Rousavy
56f3dcf1c8 chore: release 3.2.1 2023-09-30 10:52:05 +02:00
Marc Rousavy
2430058cae fix: Fix redeclaration build error on Android 2023-09-30 10:51:32 +02:00
Marc Rousavy
34f4038e05 chore: release 3.2.0 2023-09-29 21:59:26 +02:00
Marc Rousavy
b397315360 chore: Include README.md in npm package 2023-09-29 21:59:02 +02:00
Marc Rousavy
f78f05a32c chore: Add README to npm package 2023-09-29 21:56:34 +02:00
Marc Rousavy
85564d6d02
fix: Remove unused Error codes (#1887)
* fix: Remove unused Errors

* Errors.kt -> CameraError.kt

* fix: remove .system
2023-09-29 21:54:35 +02:00
Marc Rousavy
cf1952d8f7
feat: Use AHardwareBuffer* for frame.toArrayBuffer() (#1888)
* feat: Route images through `ImageWriter` into OpenGL pipeline

* fix: Use RGB format

* fix: Every device supports YUV, RGB and NATIVE

* Update VideoPipeline.kt

* log format

* Plug ImageReader between OpenGL pipeline

* Call Frame Processor

* Format

* Remove logs

* feat: Use `HardwareBuffer` for `toArrayBuffer()`

* Format
2023-09-29 21:54:04 +02:00
Marc Rousavy
954b44810b
feat: Route images through ImageWriter into OpenGL pipeline (#1874)
* feat: Route images through `ImageWriter` into OpenGL pipeline

* fix: Use RGB format

* fix: Every device supports YUV, RGB and NATIVE

* Update VideoPipeline.kt

* log format

* Plug ImageReader between OpenGL pipeline

* Call Frame Processor

* Format

* Remove logs
2023-09-29 21:52:19 +02:00
Marc Rousavy
a1fbba8d66 chore: Fix formatting 2023-09-29 19:42:28 +02:00
Touch Marine
fb812a6618
fix: Incorrect zoom on Android < 11 (#1878)
* 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>
2023-09-29 19:41:37 +02:00
Marc Rousavy
016dfa725d Update Podfile.lock 2023-09-29 15:31:35 +02:00
Marc Rousavy
9d02f5141d
fix: Use compressed buffer format as default format as well (#1884)
* fix: Use compressed buffer format as default format as well

* chore: Format Swift
2023-09-29 15:27:17 +02:00
Marc Rousavy
902dc634a4
feat: Add customizable Video Bit Rate (videoBitRate) (#1882)
* feat: Add `videoBitRate` option to `RecordVideoOptions`

* feat: Implement `videoBitRate` on iOS

* feat: Implement `videoBitRate` on Android

* chore: Format

* docs: Separate recording and photo docs

* docs: Fix links

* docs: Add docs about bitrate and quality

* docs: Add blob

* fix: Don't use inline style for CI

* fix: Correctly log default bitRate

* fix: Fix typo

* fix: Calculate default bit-rate on Android depending on resolution

* Update RecordingSession.kt
2023-09-29 15:27:09 +02:00
Marc Rousavy
fb6ebd9ee1 fix: Allow nil preferredDevice
Fixes #1870
2023-09-27 12:51:38 +02:00
Marc Rousavy
14721d314f
chore: Remove semicolons (#1846)
* chore: Disable `semi` in Prettier

* chore: Format w/o semi

* Remove more `;`

* Lint example

* More ;
2023-09-26 11:39:17 +02:00
Marc Rousavy
f7428f26a4
fix: Allow getCameraDevice to return undefined when no Devices are available (e.g. iOS Simulator) (#1848)
fix: Allow `getCameraDevice` to return `undefined` when no Devices are available
2023-09-26 11:24:24 +02:00
Marc Rousavy
bdc3fd0341 chore: release 3.1.0 2023-09-25 13:05:43 +02:00
Marc Rousavy
979656d379 chore: Update install links 2023-09-25 13:04:22 +02:00
Marc Rousavy
706341fbdb
feat: Add Templates API for choosing Camera Formats (#1844)
* docs: New V3 docs for new API

* fix: Prefer Wide-Angle unless explicitly opted-out

* docs: Update DEVICES

* Finish Devices docs

* Switch links

* Revert "Switch links"

This reverts commit 06f196ae0e67787cbd5768e125be6d0a3cb5bbc9.

* docs: New LIFECYCLE

* docs: New CAPTURING docs

* Update Worklets links

* docs: Update TROUBLESHOOTING and ZOOMING

* fix: Update `getAvailableCameraDevices()` usages

* docs: Update FORMATS

* Update Errors.kt

* docs: Fix broken links

* docs: Update references to old hooks

* docs: Create Frame Processor Tips

* docs: Auto-dark mode

* fix: Fix FPS filter

* feat: Add `'max'` flag to format filter

* fix: Use loop

* fix: Fix bug in `getCameraFormat`

* fix: Find best aspect ratio as well

* fix: Switch between formats on FPS change

* Update FRAME_PROCESSOR_PLUGIN_LIST.mdx

* Add FPS graph explanation

* feat: Add `Templates` API for choosing Camera Formats
2023-09-25 13:00:25 +02:00
Marc Rousavy
2d66d5893c
docs: New V3 docs for new API (#1842)
* docs: New V3 docs for new API

* fix: Prefer Wide-Angle unless explicitly opted-out

* docs: Update DEVICES

* Finish Devices docs

* Switch links

* Revert "Switch links"

This reverts commit 06f196ae0e67787cbd5768e125be6d0a3cb5bbc9.

* docs: New LIFECYCLE

* docs: New CAPTURING docs

* Update Worklets links

* docs: Update TROUBLESHOOTING and ZOOMING

* fix: Update `getAvailableCameraDevices()` usages

* docs: Update FORMATS

* Update Errors.kt

* docs: Fix broken links

* docs: Update references to old hooks

* docs: Create Frame Processor Tips

* docs: Auto-dark mode

* fix: Fix FPS filter

* feat: Add `'max'` flag to format filter

* fix: Use loop

* fix: Fix bug in `getCameraFormat`

* fix: Find best aspect ratio as well

* fix: Switch between formats on FPS change

* Update FRAME_PROCESSOR_PLUGIN_LIST.mdx

* Add FPS graph explanation

* feat: Support HDR filter

* docs: Add HDR docs

* docs: Add Video Stabilization

* docs: Update Skia docs

* Skia links

* Add Skia labels

* Update SKIA_FRAME_PROCESSORS.mdx

* docs: Add Performance

* Update some wording

* Update headers / and zoom

* Add examples for devices

* fix highlights

* fix: Expose `Frame`

* docs: Update FP docs

* Update links

* Update FRAME_PROCESSOR_CREATE_PLUGIN_IOS.mdx
2023-09-25 12:57:03 +02:00
Marc Rousavy
2d96381b3e
feat: New array-based useCameraFormats API (#1841)
* 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
2023-09-23 11:24:15 +02:00
Marc Rousavy
3169444697
feat: Implement resizeMode prop for iOS (#1838)
* 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
2023-09-23 10:14:27 +02:00
Maxime
c0b80b342b
feat: Respect format's aspect ratio in Preview and add resizeMode prop (#1817)
* feat(preview): respect format's aspect ratio

* fix: code guidelines and previewSize in PreviewView

* feat: add resizeMode 'cover' and 'contain' on Android
2023-09-22 17:32:34 +02:00
Marc Rousavy
9add0eb571
feat: Use C++ OpenGL GPU VideoPipeline again (#1836)
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.
2023-09-22 17:22:31 +02:00
Marc Rousavy
fffefa9d12
feat: Add support for Buffer Compression for a more efficient Video Pipeline (enableBufferCompression) (#1828)
feat: Add support for Buffer Compression for more efficient Video Pipeline (`enableBufferCompression`)
2023-09-21 17:18:54 +02:00
Marc Rousavy
aafffa60f6 fix: Fix exposing userPreferredCameraDevice on Android 2023-09-21 17:02:15 +02:00
Marc Rousavy
9809075507
feat: Support 10-bit Video HDR (#1827)
* feat: Select 10-bit YUV HDR format if HDR is enabled

* fix: Remove video EDR setting in favor of new 10-bit video HDR

* Format Swift
2023-09-21 16:30:05 +02:00
Marc Rousavy
cf4882b152
feat: Add support for LiDAR, TrueDepth, External (USB) and Continuity Camera Devices (iOS 17) (#1824)
* 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
2023-09-21 16:29:46 +02:00
Marc Rousavy
8864866f80 fix: Fix incorrect RGB pixelFormat check 2023-09-21 15:58:28 +02:00
Marc Rousavy
327aade4d8
feat: New useCameraPermission() and useMicrophonePermission() hooks (#1823)
* Create `useCameraPermission()` and `useMicrophonePermission()` hooks

* Fix exports

* Await `requestPermission()`
2023-09-21 11:40:04 +02:00
Marc Rousavy
977b859e46
feat: New JS API for useCameraDevice and useCameraFormat and much faster getAvailableCameraDevices() (#1784)
* Update podfile

* Update useCameraFormat.ts

* Update API

* Delete FormatFilter.md

* Format CameraViewManager.m ObjC style

* Make `getAvailableCameraDevices` synchronous/blocking

* Create some docs

* fix: Fix HardwareLevel types

* fix: Use new device/format API

* Use 60 FPS format as an example

* Replace `Camera.getAvailableCameraDevices` with new `CameraDevices` API/Module

* Fix Lint

* KTLint options

* Use continuation indent of 8

* Use 2 spaces for indent

* Update .editorconfig

* Format code

* Update .editorconfig

* Format more

* Update VideoStabilizationMode.kt

* fix: Expose `CameraDevicesManager` to ObjC

* Update CameraPage.tsx

* fix: `requiresMainQueueSetup() -> false`

* Always prefer higher resolution

* Update CameraDevicesManager.swift

* Update CameraPage.tsx

* Also filter pixelFormat

* fix: Add AVFoundation import
2023-09-21 11:20:33 +02:00
Marc Rousavy
9eed89aac6 chore: Upgrade version in Pods 2023-09-19 13:26:26 +02:00
ike
18c7034b50
fix: Fix h264 videoCodec type for RecordVideoOptions (#1808) 2023-09-17 19:26:25 +02:00
Marc Rousavy
4e96eb77e0
perf: Use ImageWriter instead of OpenGL Pipeline for faster processing (#1789)
* perf: Use `ImageWriter` instead of OpenGL Pipeline for faster processing

* chore: Remove C++ part of OpenGL pipeline

* Clean up

* Update README.md
2023-09-11 13:58:58 +02:00
Xavier Seignard
648c3638e8
fix: Log plugin name in assertion (#1786) 2023-09-11 11:48:26 +02:00
Marc Rousavy
297abae6bb
docs: Upgrade to Docusaurus 3 (#1783)
* docs: Upgrade to latest Docusaurus/Typedoc

* chore: Re-run typedoc

* docs: Upgrade to Docusaurus 3

* Add `docs/api/` to gitignore

* Remove `docs` from git

* Remove V3 banner

* fix: Export `PixelFormat`
2023-09-11 11:45:17 +02:00
Marc Rousavy
a4ace351fa
fix: Consider everything between 24mm and 43mm a wide-angle lense (#1782)
* fix: Consider everything between 24mm and 43mm a wide-angle lense

* chore: Use Kotlin when API instead

* Use floats

* Catch error
2023-09-11 11:33:02 +02:00
Vojtech Novak
eddb01fda1
fix: Fix potential bug in Photo Orientation (#1765) 2023-09-06 11:30:58 +02:00
rkmackinnon
6dd1d4147e
fix: Fix passing options to frame processors on iOS (#1750) 2023-09-06 11:27:35 +02:00
Marc Rousavy
b4b0e49eb5
fix: Also properly convert any[] -> List<Object> in FP Android (#1760)
* fix: Also properly convert `any[]` -> `List<Object>` in FP Android

* Format C++

* fix: Add missing return
2023-09-06 10:56:33 +02:00
Marc Rousavy
f3fd3f15e3
chore: Clean up Android codebase a bit (#1748)
<!--
                    ❤️ 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
-->
2023-09-02 01:04:36 +02:00
Marc Rousavy
620b49ee0a chore: release 3.0.0 2023-09-01 20:35:24 +02:00
Marc Rousavy
ae439e3752 Update .gitignore 2023-09-01 20:19:02 +02:00
Marc Rousavy
385014bf56 Create .bundle/config 2023-09-01 20:17:36 +02:00
Marc Rousavy
18d5400f50 Add Image to example 2023-09-01 19:52:08 +02:00
Marc Rousavy
a3b48f4951 Add start script 2023-09-01 19:49:44 +02:00
Vojtech Novak
fc0e2bf34b
fix: Fix savePhotoToFile() sometimes writing empty files (#1746) 2023-09-01 19:41:42 +02:00
Marc Rousavy
cebb7b3e89 Update .prettierrc.js 2023-09-01 19:40:04 +02:00
Marc Rousavy
325fc4d2bb chore: Change line width to 140 in C++ 2023-09-01 19:39:25 +02:00
Marc Rousavy
033ddb8cff Move prettier and babel to separate files 2023-09-01 19:39:14 +02:00
Marc Rousavy
0ee9cb3352 chore: release 3.0.0-rc.10 2023-09-01 18:53:11 +02:00
Marc Rousavy
290a20f8e3 docs: Update CONTRIBUTING 2023-09-01 18:32:23 +02:00
Marc Rousavy
036856aed5
chore: Move everything into package/ (#1745)
* Move everything into package

* Remove .DS_Store

* Move scripts and eslintrc to package

* Create CODE_OF_CONDUCT.md

* fix some links

* Update all links (I think)

* Update generated docs

* Update notice-yarn-changes.yml

* Update validate-android.yml

* Update validate-cpp.yml

* Delete notice-yarn-changes.yml

* Update validate-cpp.yml

* Update validate-cpp.yml

* Update validate-js.yml

* Update validate-cpp.yml

* Update validate-cpp.yml

* wrong c++ style

* Revert "wrong c++ style"

This reverts commit 55a3575589c6f13f8b05134d83384f55e0601ab2.
2023-09-01 18:15:28 +02:00