Commit Graph

183 Commits

Author SHA1 Message Date
Marc Rousavy
5f75b9e8dc
fix: Fix HostObject destructors to make sure a JNI Environment is set up (#2462)
* fix: Fix HostObject destructors to make sure a JNI Environment is set up

* Use `reset` instead of `= nullptr`

* Format

* Format
2024-01-30 16:51:09 +01:00
Marc Rousavy
9e1297531e
fix: Use ThreadScope::WithClassLoader to also load custom JNI Types (#2461)
* fix: Fix `ThreadScope` in `runAsync`

* fix: Use `&`

* Update JVisionCameraScheduler.cpp
2024-01-30 16:37:00 +01:00
Marc Rousavy
33e2adcec6
fix: Fix Unable to retrieve jni environment. Is the thread attached? errors by using jni::ThreadScope (#2457)
fix: Add `jni::ThreadScope` to `JVisionCameraScheduler`
2024-01-30 15:39:33 +01:00
Marc Rousavy
9089014ed8
feat: Add FPS Counter to Android (enableFpsGraph) (#2460)
* feat: Add FPS Counter to Android (`enableFpsGraph`)

* feat: Add FPS View

* Update FpsCounterView.kt

* Implement actual graph

* fix layout

* Update FpsGraphView.kt

* Update CameraPage.tsx
2024-01-30 15:28:18 +01:00
Marc Rousavy
8c5b60355f
perf: Use existing cameraQueue instead of yet another Thread (#2459)
* perf: Use existing `cameraQueue` instead of yet another Thread

* fix: Use `coroutineScope` to avoid wrong use of isActive

* fix: Do the same for `CameraSession`

* Lint
2024-01-30 14:26:55 +01:00
Marc Rousavy
af14f912fb
chore: Move onFrame into Callback on Android (#2458)
* Separate to onFrame

* Restructure FP

* Move lib loading into `CameraViewModule`
2024-01-30 14:17:32 +01:00
Amir Hossein Shekari
02bc8a979c
fix: Fix NullPointerException in initFrameProcessorPlugin if plugin is not found (#2454)
* fix: fix the null exception

* Add `Nullable` and `NonNull` annotations

---------

Co-authored-by: Marc Rousavy <me@mrousavy.com>
2024-01-30 10:52:42 +01:00
Marc Rousavy
b5eb01bac8
fix: Expose auto-focus system for Android (#2455)
* fix: Expose auto-focus system for Android

* Add `autoFocusSystem` to filter

* Update CameraDeviceDetails.kt

* Update getCameraFormat.ts
2024-01-30 10:49:28 +01:00
Marc Rousavy
bdbcf05d14
fix: Fix NullPointerException in VideoPipeline.removeRecordingSessionOutputSurface (#2453) 2024-01-29 18:59:12 +01:00
Marc Rousavy
c911d25727
fix: Fix SharedArray JSI constructor allocating a new array instead of wrapping (#2444) 2024-01-26 12:05:00 +01:00
Daniel Prado
7e2889cf84
fix: Fix maxImages have been acquired error in Frame Processor (#2430)
* fix: maxImages when frameprocessor error

* fix: Use `try`/`finally` for safety

---------

Co-authored-by: Marc Rousavy <me@mrousavy.com>
2024-01-25 18:17:48 +01:00
Marc Rousavy
bc6f954bf1
fix: Fix Android C++ SharedArray logs 2024-01-25 16:34:45 +01:00
Marc Rousavy
b1fa06514f
fix: Catch insufficient-storage errors (#2422)
* fix: Catch `insufficient-storage` errors

* feat: Implement `insufficient-storage` error for Android

* fix: Catch insufficient storage error also on takePhoto android
2024-01-24 11:48:38 +01:00
Marc Rousavy
f400487a8d
fix: Remove unneeded synchronized keyword 2024-01-18 20:02:48 +01:00
Marc Rousavy
bae1f52d4a
chore: Cleanup Android codebase (#2415) 2024-01-18 18:55:49 +01:00
Marc Rousavy
992934e00e
feat: SharedArray:wrapData:withSize init for iOS (#2410)
* feat: `ArrayBuffer:wrapData:withSize` init for iOS

* Format

* fix build error

* Update ExampleFrameProcessorPlugin.m

* docs: Add class docs for SharedArray
2024-01-18 10:41:26 +01:00
Marc Rousavy
e21a1c2110
fix: Throw not-compatible-with-outputs error when adding both CodeScannerPipeline and VideoPipeline (#2411)
* fix: Throw `not-compatible-with-outputs` error when adding CodeScanner and Video

* Format
2024-01-18 10:40:15 +01:00
Marc Rousavy
ba1d7eec9c
feat: Use JSI's ArrayBuffer instead of TypedArray (#2408)
* feat: Use JSI's `ArrayBuffer` instead of `TypedArray`

* fix: Fix move memory

* feat: Implement iOS

* Format

* Update JSIJNIConversion.cpp

* fix: Fix Android `toArrayBuffer` and other

* Catch FP call errors

* Update return type

* Use `CPU_READ_OFTEN` flag as well

* CPU flag

* Run destructors under `jni::ThreadScope`

* Update FrameProcessorPluginHostObject.cpp

* fix: Fix `toArrayBuffer()` crash

* Update Frame.ts
2024-01-17 20:18:46 +01:00
Marc Rousavy
2f21609e39
feat: Add SharedArray.getSize() (#2406)
* feat: Add `SharedArray.getSize()`

* Rename `count` to `size` on iOS

* `->` instead of `.`
2024-01-17 18:30:26 +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
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
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
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
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
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
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
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
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
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
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
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
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
2ce3b4a0ef
fix: Fix RN 0.73 compatibility (#2260) 2023-12-07 18:09:15 +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
edb415e913
fix: Fix videoCodec being parsed wrong on Android 2023-11-28 20:23:28 +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
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
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
c9dbd412be
fix: Fix VideoPipeline crash because ProGuard removed mHybridData (#2169) 2023-11-17 14:46:17 +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
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
Metrix Hungary Kft
e649aba8e1
feat: Implement cornerPoints and frame for scanned codes (#2117)
* Android & TypeScript part of scanned code corner points. Scanned frame dimensions also included in callback. #2076

* TS fix. #2076

* Implement iOS parts of code scanner corner points with additional scanned frame data.

* Add example page for code scanning

* Use Point type from Point.ts

* Update package/src/CodeScanner.ts

Add parameters description to CodeScanner callback.

Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>

* Update package/src/CodeScanner.ts

More expressive description for CodeScannerFrame.

Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>

* Update package/src/CodeScanner.ts

Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>

* Update package/src/CodeScanner.ts

Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>

* Update package/ios/Core/CameraSession+CodeScanner.swift

Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>

* Update package/ios/Core/CameraSession+CodeScanner.swift

Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>

* Remove default values from CodeSCannerFrame

* Linting

* Multiply code corner points in swift

---------

Co-authored-by: stemy <balazs.stemler@metrix.co.hu>
Co-authored-by: Zoli <iamzozo@metrix.co.hu>
Co-authored-by: Marc Rousavy <marcrousavy@hotmail.com>
2023-11-09 11:57:05 +01:00
Marc Rousavy
24ddca3409
fix: Fix Frame Processors not building because of hasWorklets flag (#2137) 2023-11-09 11:56:41 +01:00
Marc Rousavy
bb59c0a3b6
fix: Fix setting FPS lower than 30 on Samsung devices (#2138) 2023-11-09 11:56:20 +01:00
Rodrigo Gomes
1d13db25e9
fix: Fix crash on Samsung devices when using frameProcessor with YUV format (#2108)
Co-authored-by: rodrigo gomes <rodrigo.gomes@gamersafer.com>
2023-11-09 11:23:37 +01:00
Adolfo E. García
8f986a45ea
fix: Set correct namespace in build.gradle (#2104)
* fix: set correct namespace in build.gradle

* chore: refactor Android project for compatibility with multiple Gradle versions

---------

Co-authored-by: Marc Rousavy <me@mrousavy.com>
2023-10-31 15:13:12 +01:00
Christian Falch
4c9a707866
fix: Use Worklets 0.2.4 to fix FP crash (#2102)
Also changed the namespace in the build gradle to
not be com.mrousavy.camera.example - this would
crash when using dex in release mode on android.
Changed to `com.mrousavy.camera`.
2023-10-31 15:09:05 +01:00
Marc Rousavy
f4617a3918
fix: Set isRunning to true 2023-10-25 13:38:12 +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
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
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
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
217461ff5d
feat: Make Frame Processors work on API <29 (#2041) 2023-10-19 11:47:30 +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
9573ae19cb
fix: Remove unneeded kotlin-android-extensions dependency (#2034) 2023-10-18 18:22:34 +02:00
Marc Rousavy
e845dc8397
Update .gitattributes 2023-10-18 11:30:01 +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
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
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
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
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
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
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
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