Commit Graph

146 Commits

Author SHA1 Message Date
Marc Rousavy
f03dde725e
fix: Fix Skia build (#1582)
* Add Skia search path from `node_modules/`

* fix: Find `react-native-skia` from node_modules

* fix: Upgrade RN Skia to use includes fix

* Update FrameProcessorUtils.mm
2023-05-03 14:27:34 +02:00
Marc Rousavy
032798331a chore: Upgrade RN Skia 2023-05-02 12:54:18 +02:00
Marc Rousavy
bf52e8dad7 chore: Upgrade React Native for Xcode fix 2023-04-24 22:40:14 +02:00
Marc Rousavy
6deb6862cf fix: Remove temp-patch for REA plugin 2023-03-21 15:17:22 +01:00
Marc Rousavy
1ddea178ae chore: release 3.0.0-rc.2 2023-02-21 15:09:55 +01:00
Marc Rousavy
12f850c8e1
feat: Draw onto Frame as if it was a Skia Canvas (#1479)
* Create Shaders.ts

* Add `previewType` and `enableFpsGraph`

* Add RN Skia native dependency

* Add Skia Preview View on iOS

* Pass 1

* Update FrameHostObject.mm

* Wrap Canvas

* Lockfiles

* fix: Fix stuff

* chore: Upgrade RNWorklets

* Add `previewType` to set the Preview

* feat: Add Example

* Update project.pbxproj

* `enableFpsGraph`

* Cache the `std::shared_ptr<FrameHostObject>`

* Update CameraView+RecordVideo.swift

* Update SkiaMetalCanvasProvider.mm

* Android: Integrate Skia Dependency

* fix: Use new Prefix

* Add example for rendering shader

* chore: Upgrade CameraX

* Remove KTX

* Enable `viewBinding`

* Revert "Enable `viewBinding`"

This reverts commit f2a603f53b33ea4311a296422ffd1a910ce03f9e.

* Revert "chore: Upgrade CameraX"

This reverts commit 8dc832cf8754490d31a6192e6c1a1f11cdcd94fe.

* Remove unneeded `ProcessCameraProvider.getInstance()` call

* fix: Add REA hotfix patch

* fix: Fix FrameHostObject dead in runAsync

* fix: Make `runAsync` run truly async by dropping new Frames while executing

* chore: Upgrade RN Worklets to latest

* chore: Upgrade RN Skia

* Revert "Remove KTX"

This reverts commit 253f586633f7af2da992d2279fc206dc62597129.

* Make Skia optional in CMake

* Fix import

* Update CMakeLists.txt

* Update build.gradle

* Update CameraView.kt

* Update CameraView.kt

* Update CameraView.kt

* Update Shaders.ts

* Center Blur

* chore: Upgrade RN Worklets

* feat: Add `toByteArray()`, `orientation`, `isMirrored` and `timestamp` to `Frame` (#1487)

* feat: Implement `orientation` and `isMirrored` on Frame

* feat: Add `toArrayBuffer()` func

* perf: Do faster buffer copy

* feat: Implement `toArrayBuffer()` on Android

* feat: Add `orientation` and `isMirrored` to Android

* feat: Add `timestamp` to Frame

* Update Frame.ts

* Update JImageProxy.h

* Update FrameHostObject.cpp

* Update FrameHostObject.cpp

* Update CameraPage.tsx

* fix: Format Swift
2023-02-21 15:00:48 +01:00
Marc Rousavy
2909085ea6 chore: release 3.0.0-rc.1 2023-02-15 18:23:05 +01:00
Marc Rousavy
770357fd94 chore: Bump to 3.0.0-rc.0 2023-02-15 18:21:33 +01:00
Marc Rousavy
30b56153db
feat: Sync Frame Processors (plus runAsync and runAtTargetFps) (#1472)
Before, Frame Processors ran on a separate Thread.

After, Frame Processors run fully synchronous and always at the same FPS as the Camera.

Two new functions have been introduced:

* `runAtTargetFps(fps: number, func: () => void)`: Runs the given code as often as the given `fps`, effectively throttling it's calls.
* `runAsync(frame: Frame, func: () => void)`: Runs the given function on a separate Thread for Frame Processing. A strong reference to the Frame is held as long as the function takes to execute.

You can use `runAtTargetFps` to throttle calls to a specific API (e.g. if your Camera is running at 60 FPS, but you only want to run face detection at ~25 FPS, use `runAtTargetFps(25, ...)`.)

You can use `runAsync` to run a heavy algorithm asynchronous, so that the Camera is not blocked while your algorithm runs. This is useful if your main sync processor draws something, and your async processor is doing some image analysis on the side. 

You can also combine both functions.

Examples:

```js
const frameProcessor = useFrameProcessor((frame) => {
  'worklet'
  console.log("I'm running at 60 FPS!")
}, [])
```

```js
const frameProcessor = useFrameProcessor((frame) => {
  'worklet'
  console.log("I'm running at 60 FPS!")

  runAtTargetFps(10, () => {
    'worklet'
    console.log("I'm running at 10 FPS!")
  })
}, [])
```



```js
const frameProcessor = useFrameProcessor((frame) => {
  'worklet'
  console.log("I'm running at 60 FPS!")

  runAsync(frame, () => {
    'worklet'
    console.log("I'm running on another Thread, I can block for longer!")
  })
}, [])
```

```js
const frameProcessor = useFrameProcessor((frame) => {
  'worklet'
  console.log("I'm running at 60 FPS!")

  runAtTargetFps(10, () => {
    'worklet'
    runAsync(frame, () => {
      'worklet'
      console.log("I'm running on another Thread at 10 FPS, I can block for longer!")
    })
  })
}, [])
```
2023-02-15 16:47:09 +01:00
Marc Rousavy
a0590dccb5
feat: Replace Reanimated with RN Worklets (#1468)
* Setup RN Worklets

* Use RN Worklets on iOS

* Fix console

* Add `installFrameProcessorBindings()` function

* Add `FrameProcessorPlugins` proxy (BREAKING CHANGE)

* Clean up docs

* Update FRAME_PROCESSORS.mdx

* Use RN Worklets 0.2.5

* feat: Android build setup

* Rewrite Android Frame Processor Part

* Update CMakeLists.txt

* fix: Add react-native-worklets Gradle dependency

* Update Podfile.lock

* fix build

* gradle:7.4.1

* Init JSI Bindings in method on Android

* Fix Folly flags

* fix: Init `FrameProcessorRuntimeManager` later

* fix: Wrap in `<GestureHandlerRootView>`

* Refactor plugins

* fix: Remove enableFrameProcessors

* Install RN Worklets from current GH master

* Update babel.config.js

* Update CameraViewModule.kt

* Update ImageProxyUtils.java

* feat: Upgrade to Reanimated v3

* fix: Fix crash on Worklet init

* Update RN Worklets to latest master

* fix: Simplify FP Plugins Proxy
2023-02-13 15:22:45 +01:00
Marc Rousavy
11d1e7178d
chore: Upgrade to RN 71 (#1465)
* chore: Upgrade Example to RN 0.71

* chore: Upgrade all libs

* fix: Fix CameraRoll installation

* Update Gradle Tools

* fix: Fix buildscripts

* Clean out build.gradle

* fix: Fix Kotlin setup

* fix: Move kotlin-android dependency to lib

* Move `_setGlobalConsole`

* Update gradle-wrapper.properties

* Rebuild lockfiles

* chore: Update build:gradle

* Update StatusBarBlurBackground.tsx

* Use Java 11 in Workflows

* Update MediaPage.tsx

* Add `google` repository to build.gradle

* Double Java Heap size

* Increase heap size

* Alternative args

* Update build.gradle
2023-02-09 11:52:41 +01:00
Marc Rousavy
9963f4dedc chore: release 2.15.4 2023-02-01 16:37:53 +01:00
Marc Rousavy
a1a2cdc246 chore: release 2.15.3 2023-01-30 19:39:46 +01:00
Marc Rousavy
a65b8720bd chore: release 2.15.2 2022-10-31 13:05:21 +01:00
Marc Rousavy
1d6f720f8b chore: release 2.15.1 2022-10-24 14:10:30 +02:00
Marc Rousavy
849aa3ebaf chore: release 2.15.0 2022-10-20 12:50:08 +02:00
Marc Rousavy
0fbb8a3108 chore: release 2.14.1 2022-08-09 18:21:14 +02:00
Marc Rousavy
3329ee2841 chore: release 2.14.0 2022-07-18 10:42:58 +02:00
Marc Rousavy
147b9111d4 chore: release 2.13.5 2022-06-14 11:08:33 +02:00
Marc Rousavy
97f91b4fe9 Update package.json 2022-06-14 11:08:14 +02:00
Marc Rousavy
8f327267d3 chore: release 2.13.3 2022-05-05 09:56:34 +02:00
Marc Rousavy
c1d46d933b chore: release 2.13.2 2022-04-11 10:36:07 +02:00
Marc Rousavy
a7e66ed47c chore: release 2.13.1 2022-03-30 10:34:03 +02:00
Marc Rousavy
65d4d46f6a chore: release 2.13.0 2022-03-22 11:16:11 +01:00
Marc Rousavy
eb95add5ce chore: release 2.12.2 2022-03-07 12:57:18 +01:00
Marc Rousavy
ab15521c88 chore: release 2.12.1 2022-02-28 11:40:58 +01:00
Marc Rousavy
314e4c3c8b chore: release 2.12.0 2022-01-12 12:15:19 +01:00
Marc Rousavy
9577b7320b chore: release 2.11.2 2022-01-04 17:02:26 +01:00
Marc Rousavy
f4d58412a6 chore: release 2.11.1 2022-01-03 13:20:10 +01:00
Marc Rousavy
db2a883259 Update package.json 2022-01-02 18:23:44 +01:00
Marc Rousavy
8a87820078 chore: release 2.11.0 2022-01-02 18:02:22 +01:00
Marc Rousavy
138c3f9a9a chore: release 2.10.0 2021-12-10 09:58:33 +01:00
Marc Rousavy
a54ff5782c chore: release 2.9.4 2021-11-23 15:48:34 +01:00
Marc Rousavy
7206a794a9 chore: release 2.9.3 2021-10-14 12:47:45 +02:00
Marc Rousavy
bb0a09d2a1 chore: release 2.9.2 2021-10-13 15:18:56 +02:00
Marc Rousavy
3315f51faf chore: release 2.9.1 2021-10-11 20:46:13 +02:00
Marc Rousavy
bd46da614e chore: release 2.9.0 2021-10-07 11:57:37 +02:00
Marc Rousavy
916278d3ea
feat: Add React Native 0.66 support (#490)
* feat: Add React Native 0.66 support

* Generate lockfiles

* Update Podfile.lock

* chore: Migrate from react-native-navigation to react-navigation (#491)

* Migrate RNN -> RN

* Migrate all screens

* Fix get permission status

* fix app name

* Update AppDelegate.m

* Fix Info.plist

* Set `UIViewControllerBasedStatusBarAppearance` to `YES`

* Only enable `audio` if user granted microphone permission

* Update App.tsx

* Fix RNGH for Android

* Use `navigate` instead of `push`

* Fix animation

* Upgrade @types/react-native

* "Splash" -> "PermissionsPage"
2021-10-05 12:22:14 +02:00
Marc Rousavy
e1dafe05fe chore: release 2.8.3 2021-09-27 14:44:46 +02:00
Marc Rousavy
17b1d1fda4 chore: release 2.8.2 2021-09-24 17:00:42 +02:00
Marc Rousavy
60ea779ffe
fix: De-allocate frame HybridClass with JNI class loader if using Hermes (#455)
* De-allocate `frame` HybridClass with JNI class loader if using Hermes

See 1b3a0c2612

* Don't wrap in `#if FOR_HERMES`, other `jsi::Runtime`s might also run GC on another Thread.

* Use `jni::local_ref` for `FrameHostObject`

* Update JImageProxyHostObject.cpp

* Only run with JNI `ClassLoader` if ctor Thread ID != dtor Thread ID

* Upgrade reanimated to 2.3.0-beta.1 to fix JNI crash

* Remove `this_thread::get_id()`

* Update Podfile.lock
2021-09-24 16:57:12 +02:00
Marc Rousavy
e99da26561 chore: release 2.8.1 2021-09-24 10:22:42 +02:00
Marc Rousavy
d3105fa207
chore: Upgrade a whole lotta dependencies (#436)
* chore: Upgrade a lot of dependencies for `./`

* chore: Upgrade a lot of dependencies for `./example`

* chore: Upgrade a lot of dependencies for `./docs`

* Use new `EventEmitter` syntax (`.remove()`)

* Update Podfile.lock

* docs: Use watch mode

* docs: Replace all relative links with absolute

* Fix all links

* Update docusaurus.config.js

* Upgrade docusaurus-plugin-typedoc to fix docs build

* Update yarn.lock

* Upgrade typescript to 4.4.3

* Fix error unknown

* Update package.json

* Upgrade typedoc

* Upgrade a few more deps

* Fix deprecated sidebar syntax

* Update Gemfile.lock
2021-09-22 13:58:59 +02:00
Marc Rousavy
ffb4a188a2 chore: release 2.8.0 2021-09-21 15:53:50 +02:00
Marc Rousavy
e82103977f chore: release 2.7.0 2021-09-06 16:27:53 +02:00
Marc Rousavy
ad5e131f6a
feat: frameProcessorFps="auto" and automatic performance suggestions (throttle or increase FPS) (#393)
* Add `onFrameProcessorPerformanceSuggestionAvailable` and make `frameProcessorFps` support `auto`

* Implement performance suggestion and auto-adjusting

* Fix FPS setting, evaluate correctly

* Floor suggested FPS

* Remove `console.log` for frame drop warnings.

* Swift format

* Use `30` magic number

* only call if FPS is different

* Update CameraView.swift

* Implement Android 1/2

* Cleanup

* Update `frameProcessorFps` if available

* Optimize `FrameProcessorPerformanceDataCollector` initialization

* Cache call

* Set frameProcessorFps directly (Kotlin setter)

* Don't suggest if same value

* Call suggestion every second

* reset time on set

* Always store 15 last samples

* reset counter too

* Update FrameProcessorPerformanceDataCollector.swift

* Update CameraView+RecordVideo.swift

* Update CameraView.kt

* iOS: Redesign evaluation

* Update CameraView+RecordVideo.swift

* Android: Redesign evaluation

* Update CameraView.kt

* Update REA to latest alpha and install RNScreens

* Fix frameProcessorFps updating
2021-09-06 16:27:16 +02:00
Bartosz Kaszubowski
2e00b5bc33
chore: fix bootstrap script (#381) 2021-08-20 17:37:13 +02:00
Marc Rousavy
b7bfa5ef0a chore: release 2.6.1 2021-08-20 16:05:31 +02:00
Marc Rousavy
97c20d96ae chore: release 2.6.0 2021-08-20 16:03:08 +02:00
Marc Rousavy
cae08a1402
feat: Add react-native 0.65 support (#378)
* fix `;`

* upgrade react-native to 0.65.1

* upgrade example to react-native 0.65.1

* Update Podfile.lock

* Update Podfile.lock

* add `jcenter()` temporarily

* upgrade gradle tools (kotlin, build-tools, swipe-to-refresh)

* Upgrade `react-native-navigation` to `7.18.1-snapshot.1611`

* chore(deps): Upgrade a few more deps
2021-08-20 11:53:40 +02:00