Commit Graph

305 Commits

Author SHA1 Message Date
Marc Rousavy
773f278df8
fix: Use property accessors on Frame (#2400)
* fix: Use property accessors on `Frame`

* Format

* Use `_Nonnull`

* fix: Assume nonnull

* Use `NS_ASSUME_NONNULL_BEGIN` more

* Format C++
2024-01-16 20:02:03 +01:00
Marc Rousavy
9c66a09582
chore: Update swiftlint to latest (#2398) 2024-01-16 18:01:41 +01:00
Marc Rousavy
bdad4e1acb
fix: Release MediaActionSound after playing (#2390)
* fix: Release `MediaActionSound` after playing

* Make it a bit more expressive
2024-01-16 18:01:28 +01:00
Marc Rousavy
e825e21e1d
fix: Make Frame properties readonly in Types (#2397) 2024-01-16 18:00:13 +01:00
Marc Rousavy
64207ac1bf
chore: C++ format 2024-01-16 17:53:55 +01:00
Marc Rousavy
60f8a8c989
fix: Fix C++ build-error when trying to use JSITypedArray.h (#2396)
* fix: Fix C++ build-error when trying to use `JSITypedArray.h`

* Update SharedArray.h
2024-01-16 17:13:35 +01:00
Marc Rousavy
783f49e88e
chore: release 3.8.0 2024-01-15 20:18:49 +01:00
Marc Rousavy
58ef21ebfd
feat: Add minFocusDistance prop to CameraDevice (#2392)
* docs: Link `videoHdr`

* Update PERFORMANCE.mdx

* docs: Add isActive to perf

* docs: Update errors

* feat: Add `minFocusDistance` prop

* Format

* Update Podfile.lock

* fix: To Double

* fix: Import AVFoundation

* fix: Move from format -> device

* fix: Use centi-meters (cm) instead of meters

* Fix deadloop

* fix: Avoid -1 values
2024-01-15 19:30:20 +01:00
Marc Rousavy
17ae5fae76
fix: Fix CamcorderProfile out of range error (#2389)
* fix: Fix `CamcorderProfile` out of range error

* fix: Also take `cameraId` into account
2024-01-15 10:30:13 +01:00
Marc Rousavy
a4686022e2
fix: Avoid "CameraNotReady" errors when updating props in background (#2382) 2024-01-13 20:02:18 +01:00
Marc Rousavy
9ecc09cfe4
docs: Add platform: iOS annotation to regionOfInterest prop 2024-01-13 19:35:30 +01:00
Marc Rousavy
d747933892
fix: Fix SharedArray name 2024-01-12 19:25:13 +01:00
Marc Rousavy
fe614a4c21
fix: Fix JNI TypedArray error 2024-01-12 19:24:46 +01:00
Marc Rousavy
a42c799d89
Update FrameProcessorPlugin.h 2024-01-12 16:13:56 +01:00
Marc Rousavy
29fe98cc44
feat: Add zero-copy SharedArray type to Frame Processor Plugins (#2383)
* feat: Create `TypedArray` class for Frame Processor Plugins

* Type

* feat: Pass `VisionCameraProxy` along (BREAKING)

* feat: Finish implementation

* Log a bit

* feat: Successfully convert JSI <> JNI buffers

* Wrap buffer

* fix: Fix using wrong Runtime

* feat: Add docs

* add zero copy example

* Format C++

* Create iOS base

* feat: Finish iOS implementation

* chore: Format

* fix: Use `NSData` instead of `NSMutableData`

* Format

* fix: Fix build when Frame Processors are disabled

* chore: Rename `TypedArray` to `SharedArray`

* fix: Fix Swift typings for Array

* Remove a few default inits

* fix: Fix Android build

* fix: Use `NSInteger`

* Update SharedArray.mm

* fix: Expose bytes directly on iOS (NSData was immutable)
2024-01-12 16:00:36 +01:00
Marc Rousavy
56cecaa814
chore: release 3.7.1 2024-01-11 19:08:37 +01:00
Marc Rousavy
34c5b11927
feat: Re-throw error on JS side instead of just logging on native side (#2366)
* feat: Re-throw error on JS side instead of just logging on native side

* fix: Fix proxy

* fix: Fix app crash by only logging error

* fix: Use `global.ErrorUtils` (from reanimated)
2024-01-11 17:23:38 +01:00
Marc Rousavy
322b6fcbd6
fix: Fix Preview stretching on Android (#2377)
* fix: Fix Preview stretching on Android

* fix: Simplify Preview size computation

* fix: Catch `stopRepeating` error

* fix: Fix preview size calculation

* Format code

* Update CameraSession.kt

* Enable CodeScanner in example app

* fix: Also update size on surface change

* Format

* fix: Flip sizes

* Revert that stuff again

* Update PreviewView.kt

* fix: Swap width and height in SurfaceHolder::setFixedSize
2024-01-11 16:33:40 +01:00
Marc Rousavy
2b10622559
fix: Fix Camera not stopping when isActive is set to false (#2361) 2024-01-10 16:00:28 +01:00
Marc Rousavy
a8b85a3053
fix: Also call onInitialized when isActive=false
related to https://github.com/mrousavy/react-native-vision-camera/issues/2364#issuecomment-1883201425
2024-01-09 17:58:57 +01:00
Marc Rousavy
de9da64400
chore: release 3.7.0 2024-01-08 13:27:50 +01:00
Marc Rousavy
5c99728561
feat: Add new enableCodeScanner prop to build.gradle to make sure CodeScanner always works (#2355)
* feat: Always download model instead of relying on Google Play Services

* feat: Use `VisionCamera_enableCodeScanner` flag instead of unsafely replacing

* Update CODE_SCANNING.mdx
2024-01-08 13:14:47 +01:00
Erwan LE PRADO
a8c16e31d6
feat: Make enableCodeScanner expo config-plugin install the native dependency (#2348)
* feat: with gradle implementation

* chore: remove unused vars

* chore: eslint

* chore: eslint
2024-01-08 12:54:01 +01:00
Marc Rousavy
cc60ad296a
fix: Validate input props (fps, hdr, torch, ...) instead of silently crashing (#2354)
* fix: Fix Blackscreen by deterministically destroying session if `isActive=false`

* Re-open Camera if session died

* Simplify Camera

* Disconnect is optional, block when resetting state

* fix: Log in `configure { ... }`

* fix: Make concurrent configure safe

* fix: Don't resize preview

* fix: Use current `CameraConfiguration`

* Don't start if no outputs are available

* Only mount with preview outputs

* Update CameraSession.kt

* Update PreviewView.kt

* Better logging

* Update CameraSession.kt

* Extract

* fix: Rebuild entire session if `isActive` changed

* isActive safe

* Start session at 1

* Create ActiveCameraDevice.kt

* interrupts

* chore: Freeze `frame` in `useFrameProcessor`

* Revert "chore: Freeze `frame` in `useFrameProcessor`"

This reverts commit dff93d506e29a791d8dea8842b880ab5c892211e.

* chore: Better logging

* fix: Move HDR to `video`/`photo` config

* fix: Fix hdr usage

* fix: Ignore any updates after destroying Camera

* fix: Fix video HDR

* chore: Format code

* fix: Check Camera permission

* Remove unneeded error

* Update CameraSession.kt

* Update CameraPage.tsx

* Delete OutputConfiguration.toDebugString.kt

* Update CameraSession.kt

* fix: Perform sanity checks to make sure props are valid

* format
2024-01-08 12:13:05 +01:00
Marc Rousavy
0d21bc3a57
fix: Fix blackscreen issues and lifecycle when closing Camera (#2339)
* fix: Fix Blackscreen by deterministically destroying session if `isActive=false`

* Re-open Camera if session died

* Simplify Camera

* Disconnect is optional, block when resetting state

* fix: Log in `configure { ... }`

* fix: Make concurrent configure safe

* fix: Don't resize preview

* fix: Use current `CameraConfiguration`

* Don't start if no outputs are available

* Only mount with preview outputs

* Update CameraSession.kt

* Update PreviewView.kt

* Better logging

* Update CameraSession.kt

* Extract

* fix: Rebuild entire session if `isActive` changed

* isActive safe

* Start session at 1

* Create ActiveCameraDevice.kt

* interrupts

* chore: Freeze `frame` in `useFrameProcessor`

* Revert "chore: Freeze `frame` in `useFrameProcessor`"

This reverts commit dff93d506e29a791d8dea8842b880ab5c892211e.

* chore: Better logging

* fix: Move HDR to `video`/`photo` config

* fix: Fix hdr usage

* fix: Ignore any updates after destroying Camera

* fix: Fix video HDR

* chore: Format code

* fix: Check Camera permission

* Remove unneeded error

* Update CameraSession.kt

* Update CameraPage.tsx

* Delete OutputConfiguration.toDebugString.kt

* Update CameraSession.kt
2024-01-08 11:41:57 +01:00
Marc Rousavy
2cd22ad236
fix: Fix "maxImages (3) has already been acquired" error (#2352) 2024-01-05 15:51:39 +01:00
Marc Rousavy
833ffb8478
fix: Fix "The given value for videoStabilizationMode could not be parsed" error (#2353) 2024-01-05 15:51:34 +01:00
Marc Rousavy
ef4e9fabf9
fix: Unwrap boxed JNI types directly (#2337)
* fix: Unwrap boxed JNI types directly

* Update JSIJNIConversion.cpp
2024-01-02 14:13:47 +01:00
Marc Rousavy
3dc75112ae
fix: Fix crash when trying to console.log(frame) (#2335)
* feat: Override `toJSON` to support `console.log(frame)`

* Update FrameHostObject.mm

* Also use on Android

* Update FrameHostObject.mm
2024-01-02 13:54:07 +01:00
Marc Rousavy
5486be7506
Update Podfile.lock 2024-01-02 12:59:37 +01:00
Kuba Adamczyk
30c4f9e7b5
fix: Fix iOS native enableZoomGesture zoom logic (#2329)
fix a bug related to built-in zoom feature on iOS
2024-01-02 11:57:22 +01:00
Marc Rousavy
895f3ec889
feat: Make Frame thread-safe and improve error messages (#2327)
* fix: Fix multi-Thread access on Java

* fix: Thread-lock access on iOS as well

* whoops add missing header impl

* Update Podfile.lock

* fix: Don't use `CFGetRetainCount`

* fix: Lock access on iOS as well

* C++ format

* More detailed error

* chore: Move getters into `Frame`

* Format c++

* Use enum `orientation` again

* format

* fix: Synchronize `isValid` on Java

* Also log pixelformat

* feat: Use Java enums in C++

* Format C++
2023-12-29 14:09:56 +01:00
Marc Rousavy
e4393cd83a
chore: Import type only from CodeScanner 2023-12-28 11:56:40 +01:00
David Gruseck
7905f2c057
fix: Fix for inset of SENSOR_INFO_ACTIVE_ARRAY_SIZE for Android < 11 (#2306)
fix for inset of SENSOR_INFO_ACTIVE_ARRAY_SIZE

Co-authored-by: David Gruseck <david.gruseck@actinate.com>
2023-12-22 10:59:23 +01:00
Marc Rousavy
0d3ecd1131
fix: Fix min/max exposure range on Android (#2304) 2023-12-21 12:25:46 +01:00
Marc Rousavy
591cf30a06
perf: Make getCameraPermission and getMicrophonePermission synchronous (#2302) 2023-12-19 14:22:04 +01:00
Marc Rousavy
975b9f1959
chore: release 3.6.17 2023-12-14 10:55:11 +01:00
Marc Rousavy
bd5c9675b7
fix: Check torch only if needed (#2215) 2023-12-14 10:54:19 +01:00
Marc Rousavy
977bf56c6d
feat: Concurrent/Cancellable configure (#2282)
* feat: Cancellable `configure`

* Android

* Update Podfile.lock

* Configure outside of lock

* Update lockfiles

* Use `bundle` for CI

* Update script

* Update Podfile.lock

* fix: Set config at end

* Lint
2023-12-13 16:38:02 +01:00
Marc Rousavy
5a81fabedd
chore: release 3.6.16 2023-12-12 16:44:47 +01:00
Marc Rousavy
7d6c058806
Update Podfile.lock 2023-12-12 16:44:28 +01:00
Marc Rousavy
9a187c6d19
feat: Add width and height to VideoFile output (#2281)
* feat: Add `width` and `height` to `VideoFile` output

* Format
2023-12-12 16:43:57 +01:00
Marc Rousavy
98f08800f2
chore: release 3.6.15 2023-12-12 12:09:52 +01:00
Marc Rousavy
263065048c
fix: Fix Only the original thread that created a view hierarchy can touch it's views error (#2278)
* fix: Fix `Only the original thread that created a view hierarchy can touch its views` error

* fix: Also call `SurfaceHolder` method on UI Thread
2023-12-12 12:00:29 +01:00
Marc Rousavy
6107a245c4
fix: Only copy over C++ headers 2023-12-12 11:23:49 +01:00
Rodrigo Gomes
248a08b18c
feat: Support for C++ Frame Processor Plugins by publishing VisionCamera as a prefab (#2251)
* update docs

* add prefabs support
2023-12-12 11:21:21 +01:00
Marc Rousavy
df32d2c5e9
fix: Only close image once 2023-12-12 11:19:42 +01:00
Rodrigo Gomes
9600a38398
fix: Fix out-of-memory crash in QR code scanner by closing Image (#2267)
cover onCompleted listener for codescanner
2023-12-12 11:18:55 +01:00
Marc Rousavy
52f78a119b
feat: Add format filter for iso (#2234) 2023-12-12 11:16:08 +01:00
Przemysław Arlet
99491846a9
fix: Fix RN 0.73 error "'hasConstants' overrides nothing" at CameraDevicesManager.kt (#2264)
Co-authored-by: Przemysław Arlet <przemyslaw.arlet@lamel.pl>
2023-12-12 11:15:46 +01:00
Romick2005
a612eb9d38
fix: Fix NoSuchElementException in getRecommendedBitRate (#2266)
* Remove unused hasConstants method.  Do no thrown error on minBy call when filterd videoProfiles contains zero items.

* Remove not related to the fix changes.
2023-12-12 11:15:10 +01:00
Marc Rousavy
4ee52d6211
feat: Add onStarted and onStopped events (#2273)
* feat: Add `onStarted` and `onStopped` events

* Implement `onStart` for Android

* Update CameraSession.kt

* Update CameraSessionDelegate.swift
2023-12-09 19:09:55 +01:00
Marc Rousavy
9ef4a9a210
chore: release 3.6.14 2023-12-07 18:10:27 +01:00
Marc Rousavy
2ce3b4a0ef
fix: Fix RN 0.73 compatibility (#2260) 2023-12-07 18:09:15 +01:00
Marc Rousavy
d47d12edcf
chore: release 3.6.13 2023-12-04 11:48:00 +01:00
Marc Rousavy
c23f49e6bd
fix: Fix VideoProfile possibly being null (#2231)
* fix: Fix `VideoProfile` possibly being null

* Format
2023-12-04 11:46:21 +01:00
Marc Rousavy
a5e10a8606
fix: Fix torch not staying on while recording (#2249)
* fix: Fix `zoom` on native gesture

* fix: Control `torch` from JS side

* Update CameraView+RecordVideo.kt

* Update CameraView+Zoom.swift
2023-12-04 11:43:17 +01:00
Marc Rousavy
d78d3ea214
fix: Fix minFps being wrong (#2248)
* fix: Fix `minFps` being wrong

* Update AVCaptureDevice.Format+toDictionary.swift
2023-12-04 11:41:56 +01:00
Marc Rousavy
edb415e913
fix: Fix videoCodec being parsed wrong on Android 2023-11-28 20:23:28 +01:00
Marc Rousavy
980961d76f
chore: release 3.6.12 2023-11-28 12:11:08 +01:00
Marc Rousavy
c68da4540d
fix: Fix first Frame not being written in Video (#2228)
* fix: Fix first Frame not being written in Video

* Update Podfile.lock
2023-11-28 12:10:21 +01:00
Marc Rousavy
fc5fba1234
chore: release 3.6.11 2023-11-27 17:30:05 +01:00
Marc Rousavy
a28135da20
feat: Add extra-low and extra-high bit-rate options (#2225) 2023-11-27 17:29:25 +01:00
Marc Rousavy
d7f7095d1a
fix: Use bitRate multiplier instead of setting it to an absolute value (#2216)
* fix: Use `bitRate` multiplier instead of setting it to an absolute value

* Pass override

* Format

* Rename

* feat: Also implement Android

* fix: Log Mbps properly

* fix: Up-/Down-scale bit-rate if different options

* fix: Parse in Manager

* Update RecordingSession+getRecommendedBitRate.kt
2023-11-27 17:20:26 +01:00
Marc Rousavy
d78798ff84
fix: Fix focus(..) on iOS (#2220) 2023-11-27 14:43:56 +01:00
Marc Rousavy
7047686ff9
fix: Fix Recordings with audio={false} timeouting (#2221) 2023-11-27 14:43:48 +01:00
Marc Rousavy
cad5240420
fix: Move minExposure/maxExposure from format into device (#2211)
* fix: Move `minExposure`/`maxExposure` into `device`

* Update docs

* chore: Remove unneeded dependency

* chore: Update code
2023-11-24 18:20:56 +01:00
Marc Rousavy
bb3a42e6bc
fix: Fix torch not being reset after video recording (#2209) 2023-11-23 22:19:44 +01:00
Marc Rousavy
717a3534bc
chore: release 3.6.10 2023-11-23 18:17:57 +01:00
Marc Rousavy
1767e6e881
fix: Fully synchronize buffers in RecordingSession to account for late-running frames (#2206)
* fix: Fully synchronize `RecordingSession` to account for late Frames

* Restructure Code

* Update RecordingSession.swift

* Fix last audio timestamp not being used

* fix: Remove `capture/aborted` error

* Update RecordingSession.swift

* Don't log for every Frame

* Format
2023-11-23 18:17:15 +01:00
Marc Rousavy
29e649937e
Update Podfile.lock 2023-11-23 15:22:51 +01:00
Marc Rousavy
ccb04016a0
chore: release 3.6.9 2023-11-22 17:55:32 +01:00
Marc Rousavy
da0067d9f7
fix: Fix iOS not reading videoCodec and videoBitRate from options (#2202)
* fix: Fix iOS not reading `videoCodec` and `videoBitRate` from options

* Update AVVideoCodecType+descriptor.swift
2023-11-22 17:54:49 +01:00
Marc Rousavy
cf8f3d05e3
fix: Fix Video Recording delay and improve startRecording() performance (#2192)
* fix: Add more logs

* perf: Init audio AVAssetWriter in parallel

* chore: Log Audio Session activation

* perf: Init Audio Session asynchronously

* chore: Log when category changed

* fix: Revert lazy audio initialization

* Update Podfile.lock

* Pass `sourceFormatHint` to video and audio AVAssetWriter

* fix: Remove `sourceFormatHint` from Video Asset Writer

* Use default options for Audio Asset Writer

* Update Podfile.lock

* Revert "Use default options for Audio Asset Writer"

This reverts commit e575a14c5342ddc7f9db557d5e3915328ed9e798.

* Add time logs

* fix: Don't synchronize audio buffers, they are already in sync

* shouldOptimizeForNetworkUse = false

* fix: Only update `latestTimestamp` once video buffer has been written

* perf: Use `AVAssetWriterInput` instead of `AVAssetWriterInputPixelBufferAdaptor`

* fix: Fix Audio not being synchronized with Video

* Remove logs add comments

* Format

* feat: Set `.videoRecording` AVAudioSession mode

* Refactor `startRecording()` a bit

* Format

* chore: Throw error directly instead of double-checking
2023-11-22 17:53:10 +01:00
Marc Rousavy
49d58d0d0c
perf: Use lossy compressed YUV buffers if available (#2195) 2023-11-22 16:19:29 +01:00
Marc Rousavy
deb3c41ee0
chore: release 3.6.8 2023-11-19 16:43:40 +01:00
Marc Rousavy
9c5eb9105e
fix: Expose minExposure/maxExposure in format (#2179)
* fix: Expose `minExposure`/`maxExposure` in `format`

I forgot to do that on iOS before

* Update CameraDeviceFormat.swift
2023-11-19 16:43:04 +01:00
Marc Rousavy
ba0aa88cb9
fix: Also exposure 2023-11-19 15:51:33 +01:00
Marc Rousavy
73b9efb94b
fix: exposure depends on device 2023-11-19 15:50:47 +01:00
Marc Rousavy
3bd84a4215
chore: release 3.6.7 2023-11-19 15:39:43 +01:00
Marc Rousavy
95a309808e
fix: Remove exposure TODOs (#2177)
* fix: Remove exposure TODOs

* fix: Make `exposure` a Double
2023-11-19 15:38:36 +01:00
Marc Rousavy
ef58d13b87
feat: Implement exposure (#2173)
* feat: Implement `exposure` (iOS)

* Update Podfile.lock

* Format

* Expose exposure in format

* Set exposure in Camera2

* fix: Fix exposure calculation

* Add exposure docs
2023-11-19 15:26:43 +01:00
Marc Rousavy
a7e706150e
fix: Close CameraSession if the View is removed (#2174)
* fix: Close `CameraSession` if the View is removed

* fix: Use ViewManager's `onDropViewInstance` instead

* fix: Only stop repeating if we have a session

* fix: Reset `configuration` on `close()`
2023-11-18 14:58:07 +01:00
Marc Rousavy
98a641702c
fix: Log errors to console if no onError handler is passed 2023-11-18 12:16:52 +01:00
Marc Rousavy
c9dbd412be
fix: Fix VideoPipeline crash because ProGuard removed mHybridData (#2169) 2023-11-17 14:46:17 +01:00
Marc Rousavy
1055430cbb
chore: Remove photoCodec from Example App
Fixes https://github.com/mrousavy/react-native-vision-camera/issues/2159
2023-11-15 20:17:16 +01:00
Marc Rousavy
3dd56c3ba2
chore: release 3.6.6 2023-11-15 18:40:44 +01:00
Marc Rousavy
f24c00d4ce
feat: Enable HDR extension for photo capture if available (#2162) 2023-11-15 18:39:56 +01:00
Marc Rousavy
aad872bb9c
chore: No try 2023-11-15 18:38:44 +01:00
Marc Rousavy
c5dfb6c247
feat: Split videoHdr and photoHdr into two settings (#2161)
* feat: Split `videoHdr` and `photoHdr` into two settings

* fix: Rename all `hdr`

* fix: Fix HDR on Android

* Update CameraDeviceDetails.kt

* Update CameraDeviceDetails.kt

* fix: Correctly configure `pixelFormat` AFTER `format`

* Update CameraSession+Configuration.swift

* fix: Also after format changed
2023-11-15 18:33:12 +01:00
Marc Rousavy
75fd924899
fix: Fix Frame Processors not building 2023-11-15 18:04:35 +01:00
Marc Rousavy
e795ea19b1
chore: release 3.6.5 2023-11-15 17:05:08 +01:00
Marc Rousavy
abf5538bb0
feat: Support setting videoStabilizationMode (#2160)
* feat: Support setting `videoStabilizationMode`

* fix: Use `outputs`

* Format

* Set Video Stabilization Mode
2023-11-15 17:00:41 +01:00
Marc Rousavy
e8ebc6ee9f
chore: Move code 2023-11-15 15:44:19 +01:00
Marc Rousavy
dc89664be2
chore: Enable zoom gesture in CodeScanner page 2023-11-10 13:25:28 +01:00
Marc Rousavy
ca6760d6ee
feat: Show Alert when a code got scanned 2023-11-10 13:22:35 +01:00
Marc Rousavy
533bc6c291
fix: Fix CodeScanner page 2023-11-10 13:13:06 +01:00
Marc Rousavy
74ecc98cb1
chore: Change dev team to me again 2023-11-10 13:10:51 +01:00
Marc Rousavy
1b90bc9620
fix: Fix a race condition that caused audio to not be configured (#2144)
* fix: Fix a race condition that caused audio to not be configured

* Update CameraSession.swift

* fix: Fix `audioOutput` being deleted
2023-11-10 12:08:39 +01:00
Marc Rousavy
69baacad73
chore: Simplifies Code Scanner Page (#2145)
* chore: Clean up Code Scanner Page

* Update CodeScannerPage.tsx
2023-11-10 12:08:28 +01:00