Skip to content

Releases: mrousavy/react-native-vision-camera

Release 4.0.3

06 May 17:25
cbfa0c6
Compare
Choose a tag to compare

4.0.3 (2024-05-06)

✨ Features

  • Create Frame.withBaseClass to ensure it's always a FrameHostObject (#2849) (688d9f4)

📚 Documentation

  • Add react-native-vision-camera-image-labeler and react-native-vision-camera-barcodes-scanner plugins (#2841) (31d13ea)

Release 4.0.2

06 May 08:12
9ce6469
Compare
Choose a tag to compare

4.0.2 (2024-05-06)

✨ Features

  • Completely refactor the FrameProcessorPlugins.ts file into multiple files (#2830) (2e2d9b4)

🐛 Bug Fixes

  • Correct android filenames for takeSnapshot [v4] (#2812) (bfc5e35)
  • Fix app.plugin.js ESLint CI (cdbe6a9)
  • Fix RCTBlockGuard not found error (#2781) (0e5a888)
  • Fix runAsync not properly retaining/releasing Frame (#2829) (e75bb9f)
  • Fix VisionCameraProxy.workletContext being null (96c2ecf)
  • Fix CodeScanner crash (#2819) (a53166b)
  • Fix FPS Graph positioning in Skia (945c6a4)
  • Fix missing , in jsi::PropNameID (e0630eb)
  • Rename enableLocationPermission to enableLocation (f8b40fd)
  • Revert initFrameProcessorPlugin change to use VisionCameraProxy again (#2839) (d45c1c6)

📚 Documentation

  • Fix new FP Android import namespace (9812775)
  • Fix Skia invert colors shader example code (3ff02cc)
  • Lower minSdk version to 21 (d11d166)
  • Update photoHdr and lowLightBoost docs (0e9a31b)
  • Update runAsync and runAtTargetFps docs (af2707e)
  • Update react-native-vision-camera-face-detector plugin description. (#2784) (edcac50)

Release 4.0.0

22 Apr 10:03
aa6f08a
Compare
Choose a tag to compare

4.0.0 (2024-04-22)

VisionCamera V4 is finally here! 🥳🥳🥳🥳🚀💪

The most anticipated features are:

  • Skia Frame Processors: Finally it's reality - draw directly onto a Frame using react-native-skia! It has never been simpler to draw something onto a Frame, with a native iOS/Android app you'd spend days if not weeks on this.
    const frameProcessor = useSkiaFrameProcessor((frame) => {
      'worklet'
    
      // draw frame itself
      frame.render()
    
      // draw red rectangle into center of frame
      const centerX = frame.width / 2
      const centerY = frame.height / 2
      const rect = Skia.XYWHRect(centerX, centerY, 150, 150)
      const paint = Skia.Paint()
      paint.setColor(Skia.Color('red'))
      frame.drawRect(rect, paint)
    }, [])
  • CameraX rewrite: muuuuch more stability!!
  • GPS Location Tags: Adds location tags to photos and videos.

If you followed along the VisionCamera V2 -> V3 journey, you might remember that I switched from the (at-that-time-) immature CameraX library, to the low-level almost C-like Camera2 API.
The motivation behind that was that CameraX was too limiting at that time, and I wanted to gain full control over the hardware sensor and output streams.
While this worked great on my test devices, it seems like Camera2 wasn't implemented the same on all devices, and countless of weird issues arised, such as Samsung phones completely crashing, photos being rotated, frame processors running really slow on Huawei, some non-null Camera properties actually being null, etc. - the list goes on.
While I was fighting my way through Android's low-level Camera2 API, CameraX started gaining more and more interesting features, and just recently they built a new API: stream sharing.
With stream sharing, CameraX now supports all the features that VisionCamera has, and so I decided to fully rewrite the Android codebase to CameraX.
I was pretty impressed with what I built in just a few months using Camera2 APIs, but in reality this is becoming unmaintainable as countless of phone manufacturers just don't really care about Camera2 APIs, and I can't be the person monkeypatching that all the time.
Compared to VisionCamera V3, VisionCamera V4 is now much more stable, and brings a ton of new features.

✨ Features

  • Fully rewrite the Android codebase to CameraX. This brings huge stability improvements overall, and should fix countless of bugs 🥳
  • Add Skia integration to provide drawable Frame Processors! 🥳🎨
    • Add useSkiaFrameProcessor hook to create a drawable Frame Processor
    • Inside a useSkiaFrameProcessor the caller can directly draw to the frame as it extends a SkCanvas
    • Use all Skia.* APIs
    • Render the Frame with optional shaders using frame.render(shader)
  • Add GPS/EXIF Location Tags to captured photos or videos 📍
    • Add useLocationPermission hook to get location permission
    • Add enableLocation prop to <Camera>
    • Add $VCEnableLocation config option to Podfile to disable location APIs (e.g. if Apple Review is not happy with unused location APIs in your code)
  • Add photoQualityBalance prop to <Camera> to optimize the Camera pipeline for the given prioritization (speed, balanced (default) or quality)
  • Add preview prop to <Camera> to enable or disable the preview view/stream.
  • Add androidPreviewViewType prop to <Camera> to specify which preview implementation to use (surface-view is faster and supports HDR, texture-view supports transparency, masks, rotations and clipping)
  • New takeSnapshot(..) API to take instant snapshots of the video/preview streams. This can be used for intermediate results before takePhoto(..) completes. 📸
  • Use stream sharing to drop limitation of concurrent outputs - now photo, video, frameProcessor, preview and codeScanner can all be enabled at the same time!
  • Add photo HDR support to Android (using vendor-specific extensions) 🥳
  • Add video HDR support to Android (using 10-bit video HDR) 🥳
  • Always support yuv and rgb pixel-formats
    • yuv is more efficient (uses ~60% less memory than rgb, and does not need conversion)
    • rgb requires explicit conversion from yuv and will increase latency
  • Rewrite FPS Graph in JS to make it look more sexy and simplify native build (less native UI code)
  • Add support for legacy Camera1 devices
  • Lower minSdk level from 23 to 21.
  • Separate VisionCamera into three submodules/subspecs:
    • VisionCamera/Core: The core library which could be used in a native iOS/Android app
    • VisionCamera/React: React Native bindings for VisionCamera/Core
    • VisionCamera/FrameProcessors: React Native bindings for synchronous onFrame callbacks using react-native-worklets-core

❌ Deprecations

  • Remove qualityPrioritizaion parameter in takePhoto(..) in favor of new photoQualityBalance prop on <Camera>
  • Remove enablePrecapture parameter in takePhoto(..) because CameraX now properly runs precapture sequences with device-quirks ironed out
  • Remove native pixel-format since yuv is native
  • Remove enableGpuBuffers since CameraX now managed such optimizations

💨 Performance Improvements

  • Optimize for concurrent configure { ... } abort calls and give higher priority to newer update
  • Improve performance for some JNI calls (SharedArray and FrameProcessor::call)

🐛 Bug Fixes

  • Fully rewrite the Android codebase to CameraX. This brings huge stability improvements overall, and should fix countless of bugs.
  • Fix onStarted/onStopped sometimes being called a bit too early
  • Fix shutter sound playing when phone is in silent mode
  • Fix Camera not starting and appearing black on some devices
  • Fix Camera crashing because no resolution could be found
  • Fix Camera crashing the entire Android OS because GPU buffers were enabled
  • Automatically fall-back to a supported videoCodec if the given video-codec is not supported (e.g. h265 -> h264)
  • Fix Camera flipping not working sometimes
  • Use correct UIManager in findCameraView depending on the architecture (#2702) (5223f5b)

📚 Documentation

  • Update docs for Skia Frame Processors
  • Update docs for takeSnapshot
  • Update docs for V4
  • Add a ton of new Frame Processor plugins by @gev2002 (#2698) (f396ea7)
  • Update FRAME_PROCESSOR_PLUGINS.mdx (#2705) (04f89c4)

Check out the VisionCamera V4 PR (#2623) for a full list of changes.

Huge shoutout to @wcandillon for helping me get the required changes into react-native-skia! We spent a lot of time debugging weird GPU issues and optimizing the code.
These are the Skia PRs needed for the VisionCamera V4 Skia Frame Processors feature:

Release 4.0.0-beta.19

22 Apr 09:30
443e47d
Compare
Choose a tag to compare
Release 4.0.0-beta.19 Pre-release
Pre-release

4.0.0-beta.19 (2024-04-22)

✨ Features

🐛 Bug Fixes

  • Fix delegate guard (884b89d)
  • Fix ImageAnalysis is not supported when Extension is enabled error (#2770) (aec14b2)
  • Fix Timer is already canceled (c0f3ee0)
  • Fix Android import path due to new subfolder (406b741)
  • Make FpsSampleCollectorDelegate weak (e93c522)
  • Separate FpsSampleCollectorDelegate (83cac76)

📚 Documentation

Release 4.0.0-beta.18

21 Apr 23:29
fc6a19f
Compare
Choose a tag to compare
Release 4.0.0-beta.18 Pre-release
Pre-release

4.0.0-beta.18 (2024-04-21)

✨ Features

🐛 Bug Fixes

  • Fix already bound to a different lifecycle error when flipping camera (#2768) (a1b7602)
  • Simplify cpp/ codebase into android/ios folders (#2766) (1f4381a)

Release 4.0.0-beta.17

21 Apr 14:06
6cdf1ef
Compare
Choose a tag to compare
Release 4.0.0-beta.17 Pre-release
Pre-release

4.0.0-beta.17 (2024-04-21)

✨ Features

  • Separate VisionCamera into React, Core and FrameProcessors subspecs (#2764) (464ea94)
  • Separate VisionCamera into two subspecs (#2761) (f7dbb24)

🐛 Bug Fixes

  • Fix Promise resolve wrong name (e124c00)
  • Fix build for Android because of Worklet usage (9fcb61a)
  • Refactor Android codebase into core, react and frameprocessors (#2765) (991dc79)

Release 4.0.0-beta.16

19 Apr 14:53
4227040
Compare
Choose a tag to compare
Release 4.0.0-beta.16 Pre-release
Pre-release

4.0.0-beta.16 (2024-04-19)

✨ Features

🐛 Bug Fixes

  • Also override onProviderDisabled to prevent abstract method crash (b0a5585)
  • Clean up Skia resources on Worklet context to avoid race condition (#2754) (b8e44ab)
  • Fix minFps being larger in Range than maxFps (#2755) (16ccfdf)
  • Make dependencies (ModuleProxy) actually optional (#2750) (c3098db)
  • Remove enableGpuBuffers (b751f2d)

📚 Documentation

Release 4.0.0-beta.15

17 Apr 13:56
a3358ed
Compare
Choose a tag to compare
Release 4.0.0-beta.15 Pre-release
Pre-release

4.0.0-beta.15 (2024-04-17)

This is the first beta for Skia Frame Processors! 🥳
You can try this today in your app by using the useSkiaFrameProcessor hook:

const frameProcessor = useSkiaFrameProcessor((frame) => {
  'worklet'

  // 1. create blur filter
  const blurRadius = 10
  const blurFilter = Skia.ImageFilter.MakeBlur(blurRadius, blurRadius, TileMode.Repeat, null)

  // 2. wrap blur filter in Paint
  const paint = Skia.Paint()
  paint.setImageFilter(blurFilter)

  // 3. render image with the blur filter paint
  frame.render(paint)
}, [])

Note: Skia Frame Processors require react-native-worklets-core 1.1.1 or higher, react-native-reanimated 3.x.x or higher, and react-native-skia 1.2.1 or higher

Note: You might need to set pixelFormat="rgb", as "yuv" buffers are still work in progress (see Shopify/react-native-skia#2357)

✨ Features

🐛 Bug Fixes

  • Fix ResolutionSelector difference abs (#2746) (1b73b69)
  • Rename ReactLogger to VisionLogger (b89df9a)
  • Use 1280x720 for QR scanner (ca2995d)

Release 4.0.0-beta.14

16 Apr 09:47
68d01cc
Compare
Choose a tag to compare
Release 4.0.0-beta.14 Pre-release
Pre-release

4.0.0-beta.14 (2024-04-16)

✨ Features

  • Add hardware-cost-too-high error for iOS 16 (56a5c8d)

🐛 Bug Fixes

  • Always support rgb and yuv, remove native (cd9b84d)
  • Fall-back to H.264 if custom codec is not supported (4595b4f)
  • Use ResolutionSelectors with fallback values (adcca77)

Release 4.0.0-beta.13

04 Apr 09:36
b5bbcad
Compare
Choose a tag to compare
Release 4.0.0-beta.13 Pre-release
Pre-release

4.0.0-beta.13 (2024-04-04)

🐛 Bug Fixes

  • Remove mustPlayShutterSound() check (a6323cf)