📸 A powerful, high-performance React Native Camera library.
MIT License
Published by mrousavy 3 months ago
path
for takePhoto
/takeSnapshot
/startRecording
(#3103) (2ab7458)Frame
is already destroyed (#3099) (b3f5ab6)RecordingSession
edge-cases (#3102) (a8d13fa)landscape-left
(0654898)sensorOrientation
hack on iOS, it's always portrait
(#3096) (d670ca9)Published by mrousavy 3 months ago
Published by mrousavy 3 months ago
zoom
/torch
/exposure
not being applied when switching device
(#3066) (37525a2)userPreferredCameraDevice
(#3068) (36fdf7c)AVCaptureDevice.sensorOrientation
safer (#3064) (9a09260)delete()
link (c69de2a)Published by mrousavy 4 months ago
ResolutionSelector.forSize
not respecting aspect ratio (#3026) (9ca6643)Gemfile
/Bundler (#3023) (f5b55dc)portrait
, portrait-upside-down
, landscape-left
and landscape-right
options for outputOrientation
(#3025) (a773bdc)Published by mrousavy 4 months ago
[!WARNING]
Since the upgrade to react-native 0.74, VisionCamera is required to opt into the@FrameworkAPI
by React Native.
This class is only available since react-native 0.73, so react-native-vision-camera 4.3.2 now requires react-native 0.73 or above.If you are not yet on react-native 0.73 or above, either upgrade to react-native 0.73 or above, or downgrade to react-native-vision-camera 4.3.2 or below.
In a future version, react-native-vision-camera will require react-native 0.74 or higher, and will only work on the new architecture, so it is recommended to upgrade to react-native 0.74 and the new architecture as soon as possible.
Published by mrousavy 4 months ago
Published by mrousavy 4 months ago
uiRotation
a "short" rotation (#2971) (27b1feb)EUNSPECIFIED quality
error in takeSnapshot()
(#2963) (dedb1b8)MetadataProvider
location onStatusChanged
crash (#2974) (50745dd)onUIRotationChanged
rotation being 180deg inverted (#2962) (0247d83)inlineRequires
are enabled (#2953) (573ab81)Published by mrousavy 4 months ago
Published by mrousavy 4 months ago
Published by mrousavy 5 months ago
After months of planning, VisionCamera 4.1.0 now finally supports orientation! 🥳🎉
(Check out #2932 for all orientation-related changes)
cause
when stringifying CameraError
(#2898) (c659192)fps
for Frame Processor on Android (#2925) (f395a18)LocationManager
abstract method error (cd18368)rotate
function for landscape-right
sensors (38c6983)Published by mrousavy 5 months ago
componentDidUpdate()
Frame Processor comparison (#2880) (e03b7f1)runOnUiThread
executing twice if called from UI (#2883) (5335d81)withBaseClass
private, and getNativeBuffer
public (#2852) (2415e1f)Published by mrousavy 6 months ago
Published by mrousavy 6 months ago
app.plugin.js
ESLint CI (cdbe6a9)RCTBlockGuard
not found error (#2781) (0e5a888)runAsync
not properly retaining/releasing Frame (#2829) (e75bb9f)VisionCameraProxy.workletContext
being null (96c2ecf),
in jsi::PropNameID
(e0630eb)enableLocationPermission
to enableLocation
(f8b40fd)initFrameProcessorPlugin
change to use VisionCameraProxy
again (#2839) (d45c1c6)minSdk
version to 21 (d11d166)photoHdr
and lowLightBoost
docs (0e9a31b)runAsync
and runAtTargetFps
docs (af2707e)Published by mrousavy 6 months ago
VisionCamera V4 is finally here! 🥳🥳🥳🥳🚀💪
The most anticipated features are:
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)
}, [])
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.
useSkiaFrameProcessor
hook to create a drawable Frame ProcessoruseSkiaFrameProcessor
the caller can directly draw to the frame
as it extends a SkCanvas
Skia.*
APIsframe.render(shader)
useLocationPermission
hook to get location permissionenableLocation
prop to <Camera>
$VCEnableLocation
config option to Podfile
to disable location APIs (e.g. if Apple Review is not happy with unused location APIs in your code)photoQualityBalance
prop to <Camera>
to optimize the Camera pipeline for the given prioritization (speed
, balanced
(default) or quality
)preview
prop to <Camera>
to enable or disable the preview view/stream.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)takeSnapshot(..)
API to take instant snapshots of the video/preview streams. This can be used for intermediate results before takePhoto(..)
completes. 📸photo
, video
, frameProcessor
, preview
and codeScanner
can all be enabled at the same time!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 latencyVisionCamera/Core
: The core library which could be used in a native iOS/Android appVisionCamera/React
: React Native bindings for VisionCamera/Core
VisionCamera/FrameProcessors
: React Native bindings for synchronous onFrame
callbacks using react-native-worklets-corequalityPrioritizaion
parameter in takePhoto(..)
in favor of new photoQualityBalance
prop on <Camera>
enablePrecapture
parameter in takePhoto(..)
because CameraX now properly runs precapture sequences with device-quirks ironed outnative
pixel-format since yuv
is nativeenableGpuBuffers
since CameraX now managed such optimizationsconfigure { ... }
abort calls and give higher priority to newer updateSharedArray
and FrameProcessor::call
)onStarted
/onStopped
sometimes being called a bit too earlyvideoCodec
if the given video-codec is not supported (e.g. h265
-> h264
)takeSnapshot
Check out the VisionCamera V4 PR (https://github.com/mrousavy/react-native-vision-camera/issues/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:
Published by mrousavy 6 months ago
delegate
guard (884b89d)ImageAnalysis is not supported when Extension is enabled
error (#2770) (aec14b2)Timer is already canceled
(c0f3ee0)FpsSampleCollectorDelegate
weak (e93c522)FpsSampleCollectorDelegate
(83cac76)