Docs / React Native / Quick start

React Native quick start

Add react-native-facevity, set up a licence for your Android package name and iOS bundle ID, and show a beautified camera with FacevityCameraView.

Demo app: facevity-react-native-demo on GitHub

react-native-facevity wraps the native Android SDK (com.knight98:facevity 0.3.3) and the iOS SDK (pod Facevity) and exposes the same API in TypeScript. Frames never cross the bridge: they are processed natively, in <FacevityCameraView> or inside the RTC SDK’s own capture pipeline. JavaScript only sends settings.

  • New architecture: TurboModule Facevity and Fabric component FacevityCameraView. Old architecture: the same module and view through the legacy bridge, automatically.
  • React Native 0.74 or later, Android 7.0 (API 24), iOS 15.

1. Install

npm install react-native-facevity      # package source provided with your trial
cd ios && pod install

Android. Set minSdkVersion 24. The module depends on com.knight98:facevity:0.3.3: add the Facevity Maven repository to android/build.gradle (allprojects.repositories), or set it in android/gradle.properties:

facevity.mavenUrl=<Facevity Maven URL or local path from your trial>
# optional: facevity.version, facevity.agora / facevity.zego / facevity.webrtc / facevity.livekit (true / false)

iOS. Set platform :ios, '15.0' and add NSCameraUsageDescription to Info.plist. The Agora and ZEGO hooks are opt-in; react-native-webrtc and LiveKit are detected automatically:

# ios/Podfile, before the target
$FacevityRtcHooks = ['agora', 'zego']     # any subset

2. Initialize and choose a look

import { Beauty, BeautyColors, Facevity } from 'react-native-facevity';

const fv = await Facevity.initialize({ licenseToken });   // or licenseFile / licenseKey + licenseServerUrl
await fv.setParams(Beauty.NATURAL);                         // presets: Beauty.DEFAULT / NONE / NATURAL / GLAM
await fv.updateParams({ smooth: 70, bigEyes: 20 });         // some levels by name
await fv.setLipstick(BeautyColors.ROSE, 60, 40);            // shade, level, gloss; licence feature beauty.makeup
await fv.setFilter('warm', 50);

const props = await fv.availableProps();                    // 9 built-in props
await fv.setProp(props[0].id);                              // licence feature ar.props

BeautyParams is a plain object with the 21 parameters of every platform. Beauty.with clamps like the native SDKs; Beauty.withLipstick, withFilter, isIdentity, usesMakeup and usesReshape help. 0 = off, 50 = natural, 100 = strong.

3. Show the camera

import { FacevityCameraView } from 'react-native-facevity';

<FacevityCameraView
  style={{ flex: 1 }}
  facing="front"
  resizeMode="cover"
  beautyEnabled={!comparing}
  onCameraError={(e) => console.warn(e.nativeEvent)}
/>

Props: active, facing ('front' or 'back'), mirrorFront, beautyEnabled (A/B compare), resizeMode ('cover' or 'contain'); events onFrameSize, onCameraError, onFirstFrame. Request the camera permission (Android PermissionsAndroid) before mounting it.

4. Capabilities, licence and stats

const caps = await fv.capabilities();                       // hide controls that would do nothing
fv.onCapabilitiesChange(setCaps);
fv.onLicenseChange((l) => console.log(l.status));
const stats = await fv.stats();

Licences are issued for the native application IDs: the Android package name and the iOS bundle identifier (fv.appId). One licence can list both.

JS Licence source
initialize({ licenseToken }), setLicenseToken(token) a signed token from your backend
initialize({ licenseFile }), setLicenseFile(contents) an offline .fvl file’s contents
initialize({ licenseKey, licenseServerUrl }), activateLicense(key) online activation
options: { androidLicenseAsset, iosLicenseResource } a .fvl in the native bundle

5. Release

await fv.release();

Demo app and next steps

The React Native demo app has a licence screen, <FacevityCameraView> with every setting, A/B compare, live stats and one call screen per RTC SDK.

Video calls: Agora, ZEGOCLOUD, LiveKit, WebRTC. fv.compiledRtcHooks lists the hooks in the build; await fv.rtc.status() returns frame counters per provider.

Need help with an integration? Contact the Facevity team. We answer integration questions during trials.