Releases: mrousavy/react-native-vision-camera
Release list
Release 4.0.0
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
useSkiaFrameProcessorhook to create a drawable Frame Processor - Inside a
useSkiaFrameProcessorthe caller can directly draw to theframeas it extends aSkCanvas - Use all
Skia.*APIs - Render the Frame with optional shaders using
frame.render(shader)
- Add
- Add GPS/EXIF Location Tags to captured photos or videos 📍
- Add
useLocationPermissionhook to get location permission - Add
enableLocationprop to<Camera> - Add
$VCEnableLocationconfig option toPodfileto disable location APIs (e.g. if Apple Review is not happy with unused location APIs in your code)
- Add
- Add
photoQualityBalanceprop to<Camera>to optimize the Camera pipeline for the given prioritization (speed,balanced(default) orquality) - Add
previewprop to<Camera>to enable or disable the preview view/stream. - Add
androidPreviewViewTypeprop to<Camera>to specify which preview implementation to use (surface-viewis faster and supports HDR,texture-viewsupports transparency, masks, rotations and clipping) - New
takeSnapshot(..)API to take instant snapshots of the video/preview streams. This can be used for intermediate results beforetakePhoto(..)completes. 📸 - Use stream sharing to drop limitation of concurrent outputs - now
photo,video,frameProcessor,previewandcodeScannercan 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
yuvandrgbpixel-formatsyuvis more efficient (uses ~60% less memory thanrgb, and does not need conversion)rgbrequires explicit conversion fromyuvand 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 appVisionCamera/React: React Native bindings forVisionCamera/CoreVisionCamera/FrameProcessors: React Native bindings for synchronousonFramecallbacks using react-native-worklets-core
❌ Deprecations
- Remove
qualityPrioritizaionparameter intakePhoto(..)in favor of newphotoQualityBalanceprop on<Camera> - Remove
enablePrecaptureparameter intakePhoto(..)because CameraX now properly runs precapture sequences with device-quirks ironed out - Remove
nativepixel-format sinceyuvis native - Remove
enableGpuBufferssince 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 (
SharedArrayandFrameProcessor::call)
🐛 Bug Fixes
- Fully rewrite the Android codebase to CameraX. This brings huge stability improvements overall, and should fix countless of bugs.
- Fix
onStarted/onStoppedsometimes 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
videoCodecif the given video-codec is not supported (e.g.h265->h264) - Fix Camera flipping not working sometimes
📚 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:
- Shopify/react-native-skia#1365
- Shopify/react-native-skia#1377
- Shopify/react-native-skia#1539
- Shopify/react-native-skia#2261
- Shopify/react-native-skia#2344
- Shopify/react-native-skia#2345
- Shopify/react-native-skia#2356
- Shopify/react-native-skia#2357
- Shopify/react-native-skia#2372
- Shopify/react-native-skia#2385
- Shopify/react-native-skia#2388
- Shopify/react-native-skia#2389
- Shopify/react-native-skia#2390
Release 4.0.0-beta.19
4.0.0-beta.19 (2024-04-22)
✨ Features
🐛 Bug Fixes
- Fix
delegateguard (884b89d) - Fix
ImageAnalysis is not supported when Extension is enablederror (#2770) (aec14b2) - Fix
Timer is already canceled(c0f3ee0) - Fix Android import path due to new subfolder (406b741)
- Make
FpsSampleCollectorDelegateweak (e93c522) - Separate
FpsSampleCollectorDelegate(83cac76)
📚 Documentation
Release 4.0.0-beta.18
Release 4.0.0-beta.17
4.0.0-beta.17 (2024-04-21)
✨ Features
- Separate VisionCamera into
React,CoreandFrameProcessorssubspecs (#2764) (464ea94) - Separate VisionCamera into two subspecs (#2761) (f7dbb24)
🐛 Bug Fixes
Release 4.0.0-beta.16
4.0.0-beta.16 (2024-04-19)
✨ Features
🐛 Bug Fixes
- Also override
onProviderDisabledto prevent abstract method crash (b0a5585) - Clean up Skia resources on Worklet context to avoid race condition (#2754) (b8e44ab)
- Fix
minFpsbeing larger inRangethanmaxFps(#2755) (16ccfdf) - Make dependencies (
ModuleProxy) actually optional (#2750) (c3098db) - Remove
enableGpuBuffers(b751f2d)
📚 Documentation
Release 4.0.0-beta.15
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
Release 4.0.0-beta.14
4.0.0-beta.14 (2024-04-16)
✨ Features
- Add
hardware-cost-too-higherror for iOS 16 (56a5c8d)
🐛 Bug Fixes
Release 4.0.0-beta.13
Release 4.0.0-beta.12
Release 4.0.0-beta.11
4.0.0-beta.11 (2024-03-27)
💨 Performance Improvements
- Add
@FastNativeflags to critical Frame Processor methods (ff2005b)
🐛 Bug Fixes
- Fix
RCTDeviceEventEmitterimport for RN 0.71.X (#2692) (8a95414) - Fix wrong orientation enum being send to ImageCapture (#2683) (4c00ffd)
4.0.0-beta.10 (2024-03-21)
🐛 Bug Fixes
4.0.0-beta.9 (2024-03-21)
✨ Features
🐛 Bug Fixes
- Fix CodeScanner not working (c0e3a14)
- Fix focus on Android by using PX instead of DP (#2666) (f794d48)
- Remove HardwareBufferUtils (3f113e8)
4.0.0-beta.8 (2024-03-19)
✨ Features
🐛 Bug Fixes
4.0.0-beta.7 (2024-03-18)
✨ Features
🐛 Bug Fixes
- Also dont enable if other extension is enabled (5525f2b)
- Fix 10-bit HDR in combination with HDR Extension (19a7b0c)
- Fix Camera not starting because PreviewView isn't laid out (ad746d5)
- Fix capture session configuration error by manually layouting PreviewView (3d68d74)
- Properly check SDR (211783a)
- Remove focus listeners after resetting (2611625)
- Throw correct errors (5fe7608)
- Update outputs if video stabilization or low-light-boost changes (27a4f85)
- Use
CREATEDas default lifecycle state (1682bb2)
4.0.0-beta.6 (2024-03-14)
✨ Features
- Catch Objective-C init errors on plugin init (fa21983)
🐛 Bug Fixes
- Catch Objective-C errors in iOS Frame Processor Plugins (c1f274f)
- Check format requirements in outputs (79d4554)
- Fix
TimeoutExceptionby usingSTARTEDlifecycle (5283020) - Fix rotation getting (a9093cf)
- Remove
didSessionChangeFromOutside(5119639) - Remove
not-compatible-with-outputserror on Android since CameraX supports StreamSharing (8ad08f3) - Remove unneeded context (aac2162)
- Use dummy metering factory instead of display-oriented (a57d640)
4.0.0-beta.5 (2024-03-08)
✨ Features
- Add
typetoonShutter(photoorsnapshot) (f721d97) - Remove
enableAutoStabilizationprop as this was deprecated in iOS 13 (72c8c1b)
🐛 Bug Fixes
- Allow catching errors in
.await()(7ec53f7) - Allow re-creating if session changed from outside (17feff3)
- Don't play shutter sound unless explicitly enabled (f5c0131)
- Export
Snapshot.ts(6be93af) - Fix calling
sendAvailableDevicesChangedEventbefore module is initialized (b4a9086) - Only unbind current outputs, not all (50f47c5)
4.0.0-beta.4 (2024-03-01)
✨ Features
- Add
androidPreviewViewTypeprop (dd56925) - Add
cancelRecording(f51921b) - Add
onShutterevent (dd49365) - Add
takeSnapshot()toPreviewView(e17eb50) - Add CodeScanner pipeline (
ImageAnalysis) (08d86d4) - Allow setting custom format in ImageWriter (d0eb702)
- Give V4 🫴 (dd4c8fb)
- Implement native HardwareBuffer rendering for
VideoPipeline(00155c9) - Properly get orientation and isMirrored in FP (a4a78e9)
- Shutter sound and stabilization (7b46390)
- Use CameraX for device details (#2624) (54997a2)
- Use HDR or NIGHT extensions if available (b9a0434)
