Commit Graph

347 Commits

Author SHA1 Message Date
Marc Rousavy
f4617a3918
fix: Set isRunning to true 2023-10-25 13:38:12 +02:00
Marc Rousavy
ca6af86630
chore: release 3.6.4 2023-10-25 12:58:19 +02:00
Marc Rousavy
bcf201a9a3
fix: Ensure format is properly checked for equality (#2083)
* fix: Properly check for equality in `CameraDeviceFormat`

* Update CameraSession.kt

* fix: Fix `autoFocusSystem` parsing

* Format
2023-10-25 12:56:32 +02:00
Marc Rousavy
d675b6a9da
fix: Fix CodeScanner not being called (#2082) 2023-10-25 12:41:54 +02:00
Marc Rousavy
3b7f020566
feat: Basic Flash for Android (#2081)
Implements a semi-working version of flash photo capture for Android.

This isn't properly implemented because a proper implementation requires a fully custom precapture sequence that enables the torch, then waits for AE/AF to adjust, lock AE/AF, then capture with a single torch burst, and then turn the torch off again. This is quite complex, that's why the feature request #1890 is marked at $3,000.

For now, this is a simple flash burst which _sometimes works_, _sometimes not_ - highly depends on the device.

If anyone wants true working flash capture, sponsor in #1890.
2023-10-25 12:41:40 +02:00
Marc Rousavy
3b9edfb774
chore: release 3.6.3 2023-10-24 15:49:06 +02:00
Marc Rousavy
40268c4a05
fix: Fix getting triple devices with useCameraDevice (#2074) 2023-10-24 15:48:39 +02:00
Marc Rousavy
8d65d1d53c
fix: Fix physical devices detection on Android (#2073)
* fix: Fix physical devices detection on Android

* Update useCameraDevices.ts
2023-10-24 15:42:44 +02:00
Marc Rousavy
f90dace142
chore: release 3.6.2 2023-10-24 14:28:24 +02:00
Marc Rousavy
8a5dfd6ac6
fix: Fix physicalDevices DeviceType computation on Android (#2072)
* fix: Fix device type calculation on Android

* fix: Type safety for deviceTypes

* fix: Update docs
2023-10-24 14:27:47 +02:00
Marc Rousavy
5b1e5f3c9d
fix: Skip if no Preview Output is attached 2023-10-24 13:58:57 +02:00
Marc Rousavy
f91adb13be
fix: Use same error message 2023-10-24 13:44:03 +02:00
Marc Rousavy
fcefc7f9d9
chore: release 3.6.1 2023-10-24 13:39:56 +02:00
Marc Rousavy
62be941dbb
fix: Fix missing self for delegate 2023-10-24 13:39:25 +02:00
Marc Rousavy
86b3b9e1d7
chore: release 3.6.0 2023-10-24 12:00:57 +02:00
Marc Rousavy
0bc3ee12bf
Send onInitialized event only if device changed 2023-10-24 11:59:22 +02:00
Marc Rousavy
de0d6cda5d
feat: Implement atomically single-lock core/ library on Android (#2049)
* feat: Create base for `CameraConfiguration` diff

* Fix

* Write three configure methods

* Build?

* MOre

* Update CameraView+RecordVideo.kt

* Fix errors

* Update CameraDeviceDetails.kt

* Update CameraSession.kt

* Auto-resize Preview View

* More

* Make it work? idk

* Format

* Call `configure` under mutex, and change isActive

* fix: Make Outputs comparable

* fix: Make CodeScanner comparable

* Format

* fix: Update outputs after reconfiguring

* Update CameraPage.tsx

* fix: Close CaptureSession before
2023-10-24 11:19:03 +02:00
Marc Rousavy
23d173f6fc
chore: release 3.5.1 2023-10-19 18:37:06 +02:00
Marc Rousavy
5d9d153e54
fix: Fix Xcode 15 build error (var instead of let) (#2048)
* fix: Fix Xcode 15 build error (`var` instead of `let`)

* chore: Restructure code a bit for that logic

* Update CameraDevicesManager.swift
2023-10-19 17:43:20 +02:00
Marc Rousavy
00718ea0ee
fix: Set sensorOrientation to landscapeRight 2023-10-19 17:02:07 +02:00
Marc Rousavy
993b9f5a37
chore: release 3.5.0 2023-10-19 13:38:19 +02:00
Marc Rousavy
217461ff5d
feat: Make Frame Processors work on API <29 (#2041) 2023-10-19 11:47:30 +02:00
Marc Rousavy
da25aa1c1f
fix: Add getFrameProcessorPlugin for backwards compatibility (#2040) 2023-10-19 11:35:02 +02:00
Marc Rousavy
3929c0ac46
fix: Initialize Plugins in a static block of ReactPackage (#2039)
* fix: Initialize Plugins in a `static` block of ReactPackage

* fix: Also register FP Plugins in Example
2023-10-19 11:34:09 +02:00
Marc Rousavy
07027d8010
fix: Rename getFrameProcessorPlugin to initFrameProcessorPlugin (#2038)
* fix: Rename `getFrameProcessorPlugin` to `initFrameProcessorPlugin`

* fix: Make nullable, add comments

* Format

* Update FrameProcessorPlugin.java

* Update FrameProcessorPlugin.h

* fix: Fix dead links

* Call super constructor

* Update ExampleFrameProcessorPlugin.java

* fix: Init calls
2023-10-19 11:19:47 +02:00
Mateusz Mędrek
a291642c53
feat: Reintroduce Macros for Frame Processor Plugin registration (#2027)
in VisionCamera v1 & v2 there were two ObjC macros that were helping
in creation/registration of Frame Processors, but these were removed with
v3

This PR reintroduces such macros, which will not only make FP development
easier, but also it will also fix issues people had with registration of
Swift Frame Processors (+load vs +initialize issues)

Docs were also updated to reflect that the macros should be used to
correctly initialize and register ObjC/Swift Frame Processors
2023-10-19 10:35:14 +02:00
Marc Rousavy
2666ac53a6
fix: Fix build on Xcode 14 (#2033)
* fix: Fix build on Xcode 14

* Format

* Make CI run on `macOS-latest`

* Nested if
2023-10-18 18:25:30 +02:00
Marc Rousavy
9573ae19cb
fix: Remove unneeded kotlin-android-extensions dependency (#2034) 2023-10-18 18:22:34 +02:00
Marc Rousavy
89dfd351e0
fix: Fix torch not working on iOS (#2031)
* fix: Fix `torch` not working on iOS

* Format

* fix: Use `withSessionLock` and `withDeviceLock`

* Update CameraSession.swift

* Update RecordingSession.swift
2023-10-18 18:04:58 +02:00
Marc Rousavy
6956fded2d
chore: release 3.4.1 2023-10-18 17:48:04 +02:00
Marc Rousavy
764897dcf1
Update .gitattributes 2023-10-18 13:13:40 +02:00
Marc Rousavy
e845dc8397
Update .gitattributes 2023-10-18 11:30:01 +02:00
Marc Rousavy
674d96706a
fix: Fix Code Type not supported error (#2022) 2023-10-17 11:55:11 +02:00
Marc Rousavy
4e1a1fd68b
fix: Rename parsers/ to types/ (#2021)
chore: Rename `parsers/` to `types/`
2023-10-17 11:49:04 +02:00
Marc Rousavy
3b1d8353a5
chore: Add .gitattributes 2023-10-16 18:07:04 +02:00
Marc Rousavy
2af965d1ad
fix: Log in FrameProcessorPluginRegistry (#2012)
* fix: Log when adding Frame Processor Plugin

* fix: Also log on Android

* Add logs in get as well

* fix: Fix string concat on Android
2023-10-16 17:51:18 +02:00
Marc Rousavy
ce9a505776
chore: release 3.4.0 2023-10-16 17:15:12 +02:00
Marc Rousavy
5e20f9c8fa
chore: Rename CodeScanner to CodeScannerOptions in native (#2010)
* chore: Rename `CodeScanner` to `CodeScannerOptions` on native

* chore: Rename `CodeScanner` on iOS

* fix: Unwrap `options`

* Format
2023-10-16 16:56:39 +02:00
Marc Rousavy
e8ae11e30b
fix: Fix CodeScanner stalling on Android (#2009) 2023-10-16 16:28:51 +02:00
Marc Rousavy
e8df7148fa
fix: Run CodeScanner on default queue, fix stalling (#2002)
* fix: Run CodeScanner on default queue, fix stalling

* fix: Use `MAX_IMAGES` of 3
2023-10-14 13:30:21 +02:00
Marc Rousavy
ea98112a21
fix: Fix basic Orientation on iOS (#2000)
* fix: Fix basic Orientation on iOS

* ci: Use macOS 13 runner for latest Xcode 15

* chore: Remove Xcode 15 checks

* Format
2023-10-14 13:17:14 +02:00
Marc Rousavy
fab5bdc0cd
fix: Fix PreviewView overflowing on Android (#2001)
* fix: Run `addView` on UI Thread

* fix: Fix overflow of PreviewView
2023-10-14 13:17:05 +02:00
Marc Rousavy
315fcb68a8
fix: Fix FpsGraph not updating 2023-10-14 12:41:53 +02:00
Marc Rousavy
62ca95725d
fix: Fix torch not turning off after it has been enabled (#1997)
fix: Fix torch and low-light boost not turning off again
2023-10-13 18:44:44 +02:00
Marc Rousavy
cd0b413706
feat: New Core/ library (#1975)
Moves everything Camera related into `core/` / `Core/` so that it is better encapsulated from React Native.

Benefits:

1. Code is much better organized. Should be easier for collaborators now, and cleaner codebase for me.
2. Locking is fully atomically as you can now only configure the session through a lock/Mutex which is batch-overridable
    * On iOS, this makes Camera startup time **MUCH** faster, I measured speedups from **1.5 seconds** to only **240 milliseconds** since we only lock/commit once! 🚀 
    * On Android, this fixes a few out-of-sync/concurrency issues like "Capture Request contains unconfigured Input/Output Surface!" since it is now a single lock-operation! 💪 
3. It is easier to integrate VisionCamera outside of React Native (e.g. Native iOS Apps, NativeScript, Flutter, etc)

With this PR, VisionCamera V3 is up to **7x** faster than V2
2023-10-13 18:33:20 +02:00
Marc Rousavy
e8bb5cfec0
docs: Remove some links that just didn't work for some reason 2023-10-12 10:14:48 +02:00
Marc Rousavy
18e69269d4
fix: Catch errors in CaptureSession configuration 2023-10-10 19:18:54 +02:00
Marc Rousavy
727fb39f01
fix: Close previous Outputs to free memory 2023-10-10 19:17:36 +02:00
Marc Rousavy
10a44d5b79
fix: Also close outputs in destroy() 2023-10-10 19:10:42 +02:00
Marc Rousavy
bccd73d704
Revert "fix: Close CameraSession in onDetachedFromWindow() (#1962)"
This reverts commit 02726d47f7.
2023-10-10 19:06:06 +02:00
Vahid Hasani
02726d47f7
fix: Close CameraSession in onDetachedFromWindow() (#1962)
* Close camera session in onDetachedFromWindow

* Remove cache folder

---------

Co-authored-by: Marc Rousavy <me@mrousavy.com>
2023-10-10 19:01:54 +02:00
Marc Rousavy
1e7059ca8f
Revert "fix: Remove Frame Processor when Camera unmounts (#1960)"
This reverts commit d51ac1529b.
2023-10-10 18:58:47 +02:00
Tuan Luong
d51ac1529b
fix: Remove Frame Processor when Camera unmounts (#1960)
* unsetFrameProcessor when camera view is removed

* Use `this.lastFrameProcessor` instead

---------

Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>
2023-10-10 18:55:08 +02:00
Marc Rousavy
18b30cd073
fix: Always call CaptureSession fully synchronously under Mutex (#1972)
* fix: Always call `CaptureSession` fully synchronously under Mutex

* Update CameraView.kt

* chore: Format
2023-10-10 18:51:46 +02:00
Marc Rousavy
915ef331d3
feat: Extract CodeScannerPipeline & fix stalling (#1971)
* chore: Extract CodeScannerPipeline

* chore: Format

* Update CodeScannerPipeline.kt
2023-10-10 18:51:36 +02:00
Marc Rousavy
a2e5cef37e
chore: Fix docs links 2023-10-10 18:40:15 +02:00
Marc Rousavy
b33174399e
docs: Fix broken links 2023-10-10 18:21:39 +02:00
Marc Rousavy
a498144fd5
chore: Update doc URLs 2023-10-09 11:17:07 +02:00
Marc Rousavy
6e72781500
feat: Use correct photo and video format dimensions on iOS (#1929)
* feat: Use new photo dimensions API

* Update AVCaptureDevice.Format+matchesFilter.swift

* fix: Use Pixels instead of Points for video size

* feat: Set `PhotoOutput`'s maximum photo resolution

* fix: Compare dictionaries instead

* chore: Format code

* fix: Try to use hash.... failing atm

* fix: Use rough comparison again

* fix: Also take video HDR into consideration

* chore: Format

* Use contains

* Update AVCaptureDevice.Format+toDictionary.swift

* docs: Add better docs to Camera props

* Update CameraView+AVCaptureSession.swift

* Update CameraView+AVCaptureSession.swift
2023-10-06 16:11:09 +02:00
Marc Rousavy
a4448c3a7d
fix: Fix focus() on iOS (#1943) 2023-10-06 14:30:12 +02:00
Erwan LE PRADO
9d71990570
feat: Activate Torch Mode on Android (#1932) 2023-10-06 14:28:57 +02:00
Marc Rousavy
4cbe8324d5
chore: Replace ' with " 2023-10-06 13:04:34 +02:00
Marc Rousavy
36e9e00930
docs: Add **Flash** documentation 2023-10-05 16:40:15 +02:00
Marc Rousavy
3750734578 chore: release 3.3.1 2023-10-05 14:52:47 +02:00
Marc Rousavy
1843f7ac3a
feat: Add "Camera Devices" screen to Example (#1927)
* feat: Add "Camera Devices" screen to Example

* feat: Store device in MMKV
2023-10-05 14:52:03 +02:00
Marc Rousavy
658695dca5
docs: Use smaller title on mobile (#1928) 2023-10-05 14:50:36 +02:00
Marc Rousavy
cc0256a0fe chore: Fix lockfiles 2023-10-05 13:38:58 +02:00
Marc Rousavy
e4d9764637 chore: Upgrade lockfiles 2023-10-05 13:35:44 +02:00
Marc Rousavy
fab631d61a fix: Remove string-hash-64 dependency
That's a dependency of react-native-worklets-core.
2023-10-05 12:03:57 +02:00
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