Commit Graph

338 Commits

Author SHA1 Message Date
Marc Rousavy
31754eb74c
chore: release 3.9.0-beta.6 2024-02-15 17:37:19 +01:00
Marc Rousavy
129e21f14e
fix: Fix Session has been closed; further changes are illegal error by using tryStopRepeating() (#2568)
* feat: Allow focus calls to be cancelable

* Cancelable

* fix: Use `tryStopRepeating`
2024-02-15 17:34:55 +01:00
Marc Rousavy
4168d8f752
feat: Allow focus calls to be cancelable (#2567)
* feat: Allow focus calls to be cancelable

* Cancelable
2024-02-15 17:33:19 +01:00
Marc Rousavy
bcd12649e2
fix: Move PreviewView into SurfaceView to make it simpler (#2566)
* hmmm

* Set initial fixed size

* fix: Repair PreviewView again

* Update PreviewView.kt
2024-02-15 17:07:57 +01:00
Marc Rousavy
c5646ca1e2
chore: release 3.9.0-beta.5 2024-02-15 13:30:40 +01:00
Marc Rousavy
83c0184796
fix: Take Orientation into account for PreviewView (#2565)
* fix: Take Orientation into account for `PreviewView`

* Log

* Take aspect ratio into account

* Reorganize code a bit

* Set LANDSCAPE_LEFT as default

* chore: Format
2024-02-15 13:30:14 +01:00
Marc Rousavy
5df5ca9adf
fix: Fix PreviewView stretching on Android (now finally a real fix) (#2564)
* fix: Only resolve once SurfaceHolder actually resized

* fix: Fix onMeasure not being called for `PreviewView`

* fix: Auto-trigger layout computation on Surface Change

* fix: Add proper LayoutParams to `PreviewView`

* Format
2024-02-15 13:09:16 +01:00
Marc Rousavy
21042048ae
chore: release 3.9.0-beta.4 2024-02-14 17:05:05 +01:00
Marc Rousavy
a7701c8c9c
perf: Allow skipping pre-capture sequence if already focused (#2561)
This PR speeds up photo capture on Android by skipping pre-capture sequences on modes that are already focused (either AF, AE or AWB)
2024-02-14 17:04:25 +01:00
Marc Rousavy
37398cc909
feat: Flash with AE Pre-capture trigger for Android (#2558)
### Flash (`flash`)

Adds `flash` functionality with a fully custom pre-capture AE/AF/AWB trigger sequence for Android. 🎉 

```ts
camera.current.takePhoto({
  flash: 'on' // or 'auto'
})
```

### Better photos (`qualityPrioritization`)

We now also run the AE/AF/AWB precapture sequence on every photo (unless `qualityPrioritization` is `speed`), meaning photos are now less blurry, properly exposed, and properly white-balanced - so in short: **photo quality is now better!**.

The fast path still exists when using `qualityPrioritization: speed`, as that will skip the precapture sequence and metering actions and just grab an Image from the Camera as quickly as possible.

Additionally, `qualityPrioritization` now controls these options:

- [COLOR_CORRECTION_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#COLOR_CORRECTION_MODE)
- [EDGE_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#EDGE_MODE)
- [COLOR_CORRECTION_ABERRATION_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE)
- [HOT_PIXEL_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#HOT_PIXEL_MODE)
- [DISTORTION_CORRECTION_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#DISTORTION_CORRECTION_MODE)
- [NOISE_REDUCTION_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#NOISE_REDUCTION_MODE)
- [SHADING_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#SHADING_MODE)
- [TONEMAP_MODE](https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#TONEMAP_MODE)

..by setting them to `_FAST` or `_HIGH_QUALITY`, which was previously left untouched. 

This now means:
- `takePhoto({ qualityPrioritization: 'speed' })` got FASTER 🚀 
- `takePhoto({ qualityPrioritization: 'quality' })` got BETTER QUALITY 📸 
- `takePhoto({ qualityPrioritization: 'balanced' })` is left unchanged 
2024-02-14 16:43:30 +01:00
Marc Rousavy
61b2f7dd4a
chore: Improve enableGpuBuffers docs 2024-02-14 13:52:02 +01:00
Marc Rousavy
14daaaaf9d
fix: Return after configure error 2024-02-14 13:47:18 +01:00
Marc Rousavy
1a0bd8f7c2
feat: Add enableGpuBuffers property (#2557)
* Revert "fix: Fix VideoPipeline crash on Samsung (Disable `USAGE_GPU_SAMPLED_IMAGE` ImageReader) (#2555)"

This reverts commit ad33dd91b1.

* feat: Add `enableGpuBuffers` prop

* Create ImageWriter separately
2024-02-14 12:47:40 +01:00
Marc Rousavy
478688529b
fix: Fix 60 FPS crashing on some Samsungs (#2556)
* fix: Fix 60 FPS crash on Samsung by checking `CamcorderProfile.maxFps`

* Log FPS clamp

* Update CameraDeviceDetails.kt

* Format code
2024-02-14 12:47:03 +01:00
Marc Rousavy
3699ccde94
chore: Organize code 2024-02-14 11:53:17 +01:00
Marc Rousavy
ad33dd91b1
fix: Fix VideoPipeline crash on Samsung (Disable USAGE_GPU_SAMPLED_IMAGE ImageReader) (#2555)
* fix: Fix VideoPipeline crash on Samsung (`USAGE_GPU_SAMPLED_IMAGE` not supported)

* Format code
2024-02-14 11:51:24 +01:00
Marc Rousavy
0130085376
chore: Update lockfile 2024-02-14 10:58:11 +01:00
Marc Rousavy
ec7ce36d25
fix: Use acquireLatestImage instead of acquireNextImage for CodeScanner (#2549) 2024-02-13 15:15:29 +01:00
Marc Rousavy
b7e24c444e
fix: Check if session is still valid before resetting AF after focus (#2550)
* fix: Check if session is still valid before resetting AF after focus

* Update PersistentCameraCaptureSession.kt
2024-02-13 15:15:19 +01:00
Marc Rousavy
a2a2e94865
fix: Fix "Invalid pixel format 35" HardwareBuffer crash (#2547) 2024-02-13 13:52:21 +01:00
Marc Rousavy
1011c3f039
fix: Fix java.lang.NoSuchMethodError in FrameProcessor initializer (#2546) 2024-02-13 13:46:17 +01:00
Marc Rousavy
24f43efa35
feat: Add context to VisionCameraProxy (#2545) 2024-02-13 13:46:07 +01:00
Marc Rousavy
b3a88278de
perf: Fix double configuration flicker on fast device change (#2537)
* fix: Fix double configuration on device change

Fixes a situation that happened on every device change (or initial mount) where the device was configured after the session, separately, instead of just all at once causing an additonal delay/flicker of the prevjew.

* Try?

* Format

* Update CameraSession.swift

* Use `defer`

* Throw `.device`
2024-02-13 13:32:11 +01:00
Marc Rousavy
919e6c9fe8
chore: release 3.9.0-beta.3 2024-02-08 15:17:29 +01:00
Marc Rousavy
fb1d82ad9a
feat: Implement focus() on Android (#2523)
* feat: Implement `focus()` on Android

* Throw if not supported

* Do focus in example

* Format

* fix: Properly convert layer point to camera coordinates

* Fix

* Set trigger back to IDLE

* Fix rotation maybe?

* Rotated by

* fix: Fix display point calculation

* Try other

* Invoke `capture` callback on same thread

* Center metering rectangle

* Reset AF Trigger to IDLE

* Reset it to it's default AF mode again, i dont even know anymore

* Update CameraPage.tsx

* Format

* Apply options to repeating

* Set

* Use scene mode

* Update CameraPage.tsx

* Update CameraDeviceDetails.kt

* It fucking works

* Update PersistentCameraCaptureSession.kt

* Update PersistentCameraCaptureSession.kt

* Update PersistentCameraCaptureSession.kt

* Create CameraCaptureSession+setRepeatingRequestAndWait.kt

* Oh my god it works

* Also focus AE

* Cancel reset request

* Rename to AF

* Format

* Update PersistentCameraCaptureSession.kt
2024-02-08 15:16:58 +01:00
Marc Rousavy
fce6616964
chore: release 3.9.0-beta.2 2024-02-07 13:15:32 +01:00
Menardi
a4e241a431
fix: Fix photo not saving in example app on Android 13+ (#2522)
On Android 13+, requesting the WRITE_EXTERNAL_STORAGE permission
immediately denies, without asking the user. The @react-native-camera-roll/camera-roll
plugin being used already supports using scoped storage for saving
images on Android 13+, so this commit skips the permission check in that
case, since no permissions are needed.
2024-02-07 11:51:24 +01:00
Marc Rousavy
3192f5e939
fix: Fix PreviewView being stretched (#2519)
* fix: Fix Preview stretching

* feat: Keep screen on on Android

* Add test code for race condition

* fix: Fix preview stretching by awaiting SurfaceHolder resizing (`setFixedSize`)  before configuring Camera

* Format

* Update SurfaceHolder+resize.kt

* Update CameraPage.tsx
2024-02-07 11:50:33 +01:00
Marc Rousavy
b20d0fc5f7
chore: Update npm keywords 2024-02-07 10:52:07 +01:00
Marc Rousavy
395ee7af89
fix: Fix zoom not resetting in example app 2024-02-06 18:40:52 +01:00
Marc Rousavy
dbb7f80dc9
chore: release 3.9.0-beta.1 2024-02-06 14:23:57 +01:00
Marc Rousavy
5acc64e031
feat: Create persistent CaptureSession to avoid any blackscreen issues or errors (#2494)
* feat: Create custom `CaptureSession` wrapper

* Create `PersistentCameraCaptureSession`

* Update VideoStabilizationMode.kt

* Create RepeatingRequest.kt

* Update CaptureSession.kt

* Delete CaptureSession.kt

* Update PersistentCameraCaptureSession.kt

* Update PersistentCameraCaptureSession.kt

* fix: Add `isRepeating`

* Update CameraSession.kt

* Make `SurfaceOutput` not `Closable` anymore

* Update PersistentCameraCaptureSession.kt

* Stub out the rest

* Format

* Set `isRunning` properly

* Close previous outputs

* onError callback

* Format

* Started/Stopped

* Update CameraPage.tsx

* Add `isValid`

* Log `isActive`

* Add `tryAbortCaptures`

* Configure()

* Try?

* Add `didDestroyFromOutside`

* Disable FP for testing

* fix: Call `super.onAttachedToWindow` first

* Hm

* Update CameraSession.kt

* Update PersistentCameraCaptureSession.kt

* Try catch `didDestroyFromOutside`

* Update PersistentCameraCaptureSession.kt

* Session can only be active with a preview

* Update PersistentCameraCaptureSession.kt

* Throw `no-outputs` if needed

* Update logs

* fix: Check for CAMERA permission

* fix: Close session when opening a new device

* perf: Make everything `by lazy` in CameraDeviceDetails

* Update CameraDeviceDetails.kt

* Update PersistentCameraCaptureSession.kt

* Update PersistentCameraCaptureSession.kt

* Move

* Update Podfile.lock

* Implement `capture()`

* Format

* fix: Fix orientation not being applied

* fix: Fix `isMirrored`

* fix: Fix getting size

* fix: Close `Surface` in `VideoPipeline`

* Format

* fix: Fix `VideoPipeline` not properly destroying itself

* Use FP again

* Update CameraConfiguration.kt

* Rename

* Clean up

* Format

* Update CameraConfiguration.kt

* fix: Don't stop repeating request when capturing
2024-02-06 14:19:25 +01:00
Lucas Garcez
cd5fdd4924
fix: Properly type Format Templates (#2499)
add PredefinedTemplates type
2024-02-05 12:37:42 +01:00
Marc Rousavy
d8c95c901f
feat: Synchronize Frame properly (#2501)
* feat: Synchronize `Frame` properly

* Update CameraError.ts

* Image is not valid if `refCount` < 0
2024-02-05 12:34:32 +01:00
Marc Rousavy
e95264f782
fix: Fix minFocusDistance being NaN on some emulators 2024-02-02 09:54:17 +01:00
Marc Rousavy
8c66d36d8f
chore: release 3.9.0-beta.0 2024-02-01 12:40:52 +01:00
Marc Rousavy
1a8e518180
chore: Remove unused frameProcessor variable 2024-02-01 11:55:31 +01:00
Marc Rousavy
5f339c60c6
chore: Update Podfile.lock 2024-01-31 21:09:42 +01:00
Marc Rousavy
ae75e22fc0
fix: Fix crash in toArrayBuffer() by properly acquiring a reference on AHardwareBuffer* (#2490)
* fix: Fix crash in `toArrayBuffer()` by properly acquiring a reference on `AHardwareBuffer*`

* Format

* Update Podfile.lock
2024-01-31 20:32:02 +01:00
Marc Rousavy
f896831d4a
fix: Properly check HardwareBuffer usage flags before setting them (#2488)
* fix: Properly check `HardwareBuffer` usage flags before setting them

* fix: Use GPU flag if pixel format is NATIVE

* Update VideoPipeline.kt

* Add some logs

* fix: Properly convert ImageFormat to HardwareBufferFormat

* Update Podfile.lock

* fix: Add a safe `getHardwareBufferFormat` method

* Format
2024-01-31 20:31:56 +01:00
dependabot[bot]
fb96d000bc
feat: Bump org.jetbrains.kotlinx:kotlinx-coroutines-android from 1.5.2 to 1.7.3 (#2467)
Might be a breaking change as there have been some in that dependency.

chore(deps): bump org.jetbrains.kotlinx:kotlinx-coroutines-android

Bumps [org.jetbrains.kotlinx:kotlinx-coroutines-android](https://github.com/Kotlin/kotlinx.coroutines) from 1.5.2 to 1.7.3.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.5.2...1.7.3)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:32:01 +01:00
dependabot[bot]
26579cd931
chore(deps-dev): bump @babel/runtime from 7.23.6 to 7.23.9 in /package/example (#2485)
chore(deps-dev): bump @babel/runtime in /package/example

Bumps [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) from 7.23.6 to 7.23.9.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.9/packages/babel-runtime)

---
updated-dependencies:
- dependency-name: "@babel/runtime"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:30:31 +01:00
dependabot[bot]
ba2aa89781
chore(deps): bump react-native-safe-area-context from 4.8.0 to 4.8.2 in /package/example (#2484)
chore(deps): bump react-native-safe-area-context in /package/example

Bumps [react-native-safe-area-context](https://github.com/th3rdwave/react-native-safe-area-context) from 4.8.0 to 4.8.2.
- [Release notes](https://github.com/th3rdwave/react-native-safe-area-context/releases)
- [Commits](https://github.com/th3rdwave/react-native-safe-area-context/commits/v4.8.2)

---
updated-dependencies:
- dependency-name: react-native-safe-area-context
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:30:06 +01:00
dependabot[bot]
793ba4860d
chore(deps-dev): bump @types/react from 18.2.43 to 18.2.48 in /package/example (#2483)
chore(deps-dev): bump @types/react in /package/example

Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.2.43 to 18.2.48.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:29:57 +01:00
dependabot[bot]
ac69bfda44
chore(deps-dev): bump prettier from 3.1.1 to 3.2.4 in /package/example (#2482)
Bumps [prettier](https://github.com/prettier/prettier) from 3.1.1 to 3.2.4.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.1.1...3.2.4)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:29:50 +01:00
dependabot[bot]
75bd937473
chore(deps-dev): bump @expo/config-plugins from 7.2.5 to 7.8.4 in /package (#2477)
chore(deps-dev): bump @expo/config-plugins in /package

Bumps [@expo/config-plugins](https://github.com/expo/expo/tree/HEAD/packages/@expo/config-plugins) from 7.2.5 to 7.8.4.
- [Changelog](https://github.com/expo/expo/blob/main/packages/@expo/config-plugins/CHANGELOG.md)
- [Commits](https://github.com/expo/expo/commits/HEAD/packages/@expo/config-plugins)

---
updated-dependencies:
- dependency-name: "@expo/config-plugins"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:29:28 +01:00
dependabot[bot]
d8e0577698
chore(deps-dev): bump prettier from 3.1.1 to 3.2.4 in /package (#2475)
Bumps [prettier](https://github.com/prettier/prettier) from 3.1.1 to 3.2.4.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.1.1...3.2.4)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:29:06 +01:00
dependabot[bot]
d5d7471f80
chore(deps-dev): bump @react-native/typescript-config from 0.73.1 to 0.74.0 in /package (#2473)
chore(deps-dev): bump @react-native/typescript-config in /package

Bumps [@react-native/typescript-config](https://github.com/facebook/react-native/tree/HEAD/packages/typescript-config) from 0.73.1 to 0.74.0.
- [Release notes](https://github.com/facebook/react-native/releases)
- [Changelog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/react-native/commits/HEAD/packages/typescript-config)

---
updated-dependencies:
- dependency-name: "@react-native/typescript-config"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:28:52 +01:00
dependabot[bot]
a346a011b2
chore(deps-dev): bump @types/react from 18.2.43 to 18.2.48 in /package (#2470)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.2.43 to 18.2.48.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-31 17:28:25 +01:00
Marc Rousavy
060d3f6831
chore: Use npm for demos 2024-01-31 17:17:58 +01:00