Docs / API reference

API reference

One vocabulary on every platform: the same parameter names, presets, shades, filters, props, licence features and statuses, spelled for Kotlin, Swift, TypeScript, Dart and TSX.

Names of parameters, presets, filters, lipstick shades, licence features and statuses, error codes and prop anchors come from one shared specification and are spelled the same everywhere: camelCase parameters, beauty.basic-style features, VALID-style statuses. The code tabs below remember the platform you pick.

Naming across platforms

AndroidiOSWebFlutterReact Native
Packagecom.knight98:facevitypod Facevity@facevity/webfacevity_flutterreact-native-facevity
Importcom.knight98.facevityimport Facevityfrom '@facevity/web'package:facevity_flutter/facevity_flutter.dartfrom 'react-native-facevity'
Version0.3.30.4.0-alpha0.4.0-alpha0.4.0-alpha0.4.0-alpha
Callssynchronoussynchronoussynchronous, initialize asyncasync (Future)async (Promise)
PresetsBeautyParams.NATURAL.NATURALBeautyParams.NATURALBeautyParams.naturalBeauty.NATURAL
ShadesBeautyColors.LIP_ROSEBeautyColors.lipRoseBeautyColors.LIP_ROSEBeautyColors.roseBeautyColors.ROSE
Camera viewyour rendereryour renderercreateProcessedTrackFacevityPreview<FacevityCameraView>
App IDpackage namebundle IDweb domainpackage name, bundle IDpackage name, bundle ID

Create the engine

val fv = Facevity.initialize(context, FacevityOptions.Builder()
    .maxFaces(1)
    .licenseToken(token)
    .build())

One engine per camera pipeline (web: per processed stream). Flutter and React Native keep one native engine per process; later initialize calls return it.

Presets and levels

fv.setParams(BeautyParams.NATURAL)                  // NATURAL, GLAM, DEFAULT, NONE
fv.setSmoothIntensity(60)
fv.setParams(fv.params.toBuilder().smooth(70).bigEyes(20).build())
fv.setBeautyEnabled(false)                           // exact pass-through

Every 0..100 level follows one scale: 0 = off, 50 = natural, 100 = strong but still realistic. Values are clamped. Single-level setters on Android, iOS and Web: setSmoothIntensity, setBrightness, setSkinTone, setRosy, setEvenTone, setOverallIntensity. All parameters: BeautyParams.

Makeup, teeth and backlight

fv.setLipstick(BeautyColors.LIP_ROSE, 60)            // shade, level
fv.setParams(fv.params.toBuilder().lipGloss(70).build())
fv.setTeethWhitening(50)
fv.setBacklightFix(50)                               // automatic, 0 = off

Shades: nude, rose, red, berry, coral, plum, or any colour with BeautyColors.rgb(r, g, b). The natural shade (0) enriches the lips' own colour. The lip region is computed from the current frame's lip contours, so the tint follows the mouth while the user speaks.

Colour filters

fv.setParams(fv.params.toBuilder().filter("warm", 50).build())

Filters: origin (none), natural, warm, cool, fresh, vivid, soft, rose, mono.

AR accessories

val props = fv.availableProps()                      // PropInfo(id, name, anchor)
fv.setProp("aviator")                                // false for an unknown id
fv.clearProp()
val icon = fv.propIcon("aviator")                    // 128x128 bitmap
fv.addPropsDirectory(File(filesDir, "props"))        // your own pack

Built-in ids: aviator, wayfarer, sport_goggles, round_glasses, heart_glasses, crown, flower_headband, cat_ears, earring. Anchors: eyes, forehead, head_top, nose, ears, face. A prop is a folder with prop.json, prop.png and icon.png. Licence feature ar.props.

Capabilities

val caps = fv.capabilities()
fv.prepareCapabilities()                             // loads the segmenter early
fv.addCapabilitiesListener { c -> runOnUiThread { lipstickButton.isVisible = c.lipstickSupported } }

Fields: lipstickSupported (beauty.makeup), teethWhiteningSupported, backlightSupported, reshapeSupported (beauty.reshape), propsSupported (ar.props). Use them to hide controls the licence does not cover.

Frames

Android, iOS and Web take frames directly. Flutter and React Native process frames natively in their camera views and RTC hooks, so there is no frame call in Dart or JavaScript.

// texture path, on the GL thread
val out: Int = fv.processTexture(TextureFrame(oesTex, isOes = true, w, h, rotation, mirrored = front, ts, matrix))

// buffer path, any thread, in place
val changed: Boolean = fv.processBuffer(BufferFrame(bytes, PixelFormat.NV21, w, h, rotation, false, ts))
  • Rotation is how far the raw frame must turn clockwise to be upright. The output keeps the input orientation.
  • Android texture path returns the input id when nothing was done, otherwise an engine-owned 2D texture (identity matrix, valid until the call after next). OutputLayout.SAME_AS_INPUT keeps the SurfaceTexture layout. FrameOrientation has uprightRotation, displayMatrix and camera-transform helpers; YuvPlanes.packI420 / unpackI420 handle strided planes.
  • Pass-through: when isActive is false (beauty off, all levels 0) frames come back untouched; skip conversions.

Licence

fv.setLicenseToken(token)
fv.setLicenseFile(context.assets.open("facevity.fvl"))
fv.activateLicense("FV-XXXX-XXXX-XXXX-XXXX") { info -> Log.i("App", "${info.status}") }
fv.addLicenseListener { info -> /* refresh, expiry, revocation */ }
val status = fv.licenseInfo.status

A token that verifies replaces the cached one at once, so a freshly minted token with more features applies to the running engine. See Licensing.

Diagnostics and lifecycle

val s = fv.stats()          // framesIn, framesProcessed, framesDropped, framesRepeated, avgProcessMs, processFps, …
fv.resetTracking()           // after a camera switch
fv.onGlContextDestroyed()    // on the GL thread, before the context goes away
fv.release()

Debug views (setDebugMaskView(0..7)): 3 = final skin weight, 4 = segmentation, 5 = lipstick weight, 6 = backlight region, 7 = lip region.

BeautyParams

The same 21 parameters on every platform. Immutable and clamped on Android, iOS and Flutter; a plain object on Web and React Native.

ParameterRangeDefaultEffect
smooth0..10055Skin smoothing
brightness0..10040Skin-only mid-tone lift
skinTone-100..1000Cooler to warmer skin
rosy0..10042Healthy tint on mid-tones
sharpen0..10040Clarity on eyes, brows and hair
eyeBrighten0..1000Iris lift, whites cleared
underEye0..10043Dark circles
evenTone0..10030Redness and blotches
foldSoften0..1000Smile lines
teethWhitening0..1000Acts only while teeth show
teethBrighten0..10040Extra lift on whitened teeth
backlightFix0..10050Automatic; 0 = off
lipColor0..1000Natural lip boost, or lipstick opacity with a shade
lipShade0xRRGGBBnaturalLipstick shade (licence beauty.makeup)
lipGloss0..100300 matte to 100 gloss
slimFace0..1000Cheek slimming (beauty.reshape)
jawSlim0..1000Jaw, V-line (beauty.reshape)
bigEyes0..1000Eye enlarging (beauty.reshape)
filteridoriginorigin, natural, warm, cool, fresh, vivid, soft, rose, mono
filterLevel0..10054Filter strength
overall0..100100Scales every level at once

Helpers: isIdentity, usesReshape, usesMakeup; Android toBuilder(), BeautyParams.Builder, fromUnit(Float); iOS with { }, BeautyParams.Builder; Flutter copyWith, withLipstick, withFilter; React Native Beauty.with, Beauty.withLipstick, Beauty.withFilter. NONE also turns backlight off.

Options

OptionValuesDefaultPlatforms
maxFaces1..41all
detectionLongSide160..640 px320all
segmentationauto (GPU only), on, offautoall
unlicensedBehaviorwatermark, passthroughwatermarkall
offlineGraceDays1..307all
allowDevLicensesunset = debug builds or dev hosts onlyunsetall
licenseToken, licenseServerUrltoken, URL (Web: licenseServer, licenseKey)all
bufferBudgetMs, adaptiveBufferBudget, maxBufferBudgetMs, bufferPipeliningbuffer-path timing40, on, 80, onAndroid, Flutter, RN
yuvFullRangeBT.601 full or video rangefullAndroid, iOS, Flutter, RN
licenseAsset / licenseResourcebundled .fvlfacevity/license.fvl, facevity-license.fvlAndroid / iOS
detectorProvideryour own landmark providerMediaPipeiOS
assetsBaseUrl, wasmBaseUrl, faceModelUrl, propsBaseUrl, faceSourceasset locations, your own landmarksassets/Web

Licence types

  • LicenseStatus: VALID and OFFLINE_GRACE are licensed. Not licensed: NONE, EXPIRED, OFFLINE_GRACE_EXCEEDED, NOT_YET_VALID, INVALID_SIGNATURE, UNKNOWN_KEY, MALFORMED, WRONG_ISSUER, WRONG_AUDIENCE, WRONG_DEVICE, WRONG_CERTIFICATE, WRONG_ENVIRONMENT, SUSPENDED, REVOKED. Dart uses lowerCamelCase (LicenseStatus.wrongAudience).
  • LicenseInfo: status, type (TRIAL, PRODUCTION, INTERNAL), environment, licence id, customer, features, issue and expiry dates, watermark, offline flag.
  • Features: beauty.basic, beauty.reshape, buffer.path, beauty.segmentation, beauty.makeup, ar.props. See Licensing.

FaceUnity-style kit

On Android (com.knight98.facevity.kit), iOS and Web, the kit follows FaceUnity's call flow over the same engine:

FVRenderManager.setup(context, licenseToken, callback)
val kit = FVRenderKit.getInstance()
kit.aiKit.loadAIProcessor()
kit.faceBeauty = FVFaceBeauty().apply { smoothIntensity = 3.0 }   // 0..6, 3.0 = natural
val out = kit.renderWithInput(input)                               // FVRenderInputData -> FVRenderOutputData

Members: FVRenderManager.setup / setupWithKey, FVRenderKit (faceBeauty, aiKit, renderWithInput, setProp, capabilities(), release()), FVAIKit (loadAIProcessor, setMaxFaces, isTracking(), resetTrackStatus()), FVFaceBeauty with FaceUnity's value ranges, FVRenderInputData / FVRenderOutputData, FVCodes. Full mapping: Migrating from FaceUnity.

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