Entry points
| Export | Purpose |
|---|---|
NosmaiCameraSdk | Typed TurboModule-backed operational API |
NosmaiCameraView | Fabric preview view for processed camera output |
NosmaiSdkError | Stable typed error with code, message, and safe native details |
| Expo config plugin | Adds required native project configuration for an Expo development build |
Version 2.0.1 requires React Native 0.81.5, React 19.1, New Architecture, Node 20.19.4 or later, and a physical supported device. Android supports arm64-v8a and armeabi-v7a; iOS requires a physical arm64 device. Expo Go cannot load the native module.
Lifecycle and preview
Use initialize, mount NosmaiCameraView, then call startProcessing after the view is ready. The lifecycle surface also includes stopProcessing, pauseCamera, resumeCamera, switchCamera, and cleanup. Keep one mounted preview and await cleanup before creating another SDK camera screen.
Packages and parameters
applyFilter(packagePath) is the unified package call. Query state through getActiveEffects, getActiveFilterInfo, and getActiveEffectInfo; clear with clearFilter, clearAREffect, removeEffect, or clearAll. Authored controls use getEffectParameters, getEffectParameterValue, setEffectParameter, and setEffectParameterString.
Catalog and Cloud Filters
Cloud operations use isCloudFilterEnabled, getCloudFilters(query), downloadCloudFilter(filter), and removeCloudFilter(filter). Apply the local URI returned by the download result; do not construct a private service URL.
Visual controls
Call prepareBeautyFilters() after NosmaiCameraView reports ready. Use isBeautyPrepared() to read readiness for the current session.
| API | Contract |
|---|---|
setBeautyVisible(visible) / isBeautyVisible() | Hides or restores built-in beauty while preserving configured values. |
applyContourHighlighter({ contour, highlighter }) | Independent contour and highlighter strengths from 0...2. |
applyFreckles(quantity) | Freckle quantity from 0...1. |
applyFoundation({ shade, color, coverage }) / removeFoundation() | Applies a preset or custom foundation colour with 0...1 coverage. |
applyDarkCircleCorrector(intensity) / removeDarkCircleCorrector() | Under-eye correction from 0...1. |
setHairColor(color, intensity), setHairColorIntensity, removeHairColor, isHairColorActive | Controls the optional native hair-colour layer. |
Version 2.0.1 also exposes skin smoothing, whitening, teeth whitening, makeup layers, signed reshape controls, eye colour, brightness, contrast, RGB, sharpening, grayscale, hue, white balance, HSB, and manual blur, colour, image, or video backgrounds. Standard strengths use 0...1; signed reshapes use -1...1; contour, highlighter, lipstick, and blusher support 0...2. Check the beauty and advanced-feature capability methods before showing gated controls.
Makeup styles and palettes
applyMakeup({ type, style, color?, intensity? }) accepts lipstick, eyeshadow, blusher, eyelash, or eyebrow with a style supported by that layer. color uses normalized red, green, and blue fields. Omit it to use a native default; eyelashes use style and strength only.
Query getLipstickColors, getEyeshadowColors, getBlusherColors, or getEyebrowColors for named NosmaiMakeupColor swatches. Update a layer with setMakeupIntensity(type, intensity), inspect isMakeupActive(type), remove it with removeMakeup(type), or call clearMakeup() for all makeup layers.
Lipstick and blush accept 0...2; the other layers accept 0...1. Invalid types, styles, and out-of-range values reject the Promise. See Makeup styles and palettes for supported values and complete examples.
Face reshaping
setReshape(type, value) returns Promise<void>. NosmaiReshapeType is the string union lip, faceSlim, eye, nose, chin, brow, browThickness, jaw, mouthWidth, or forehead. Values must be finite and within -1...1, with 0 as neutral; invalid input rejects the Promise. Native integer type IDs are not accepted by this JavaScript API.
Reset one type with setReshape(type, 0), or call clearReshaping() for all unified shape controls without requesting a full beauty reset. See Face reshaping for type directions, slider handling, lifecycle guidance, and examples.
Runtime face stickers
Use setFaceSticker({ uri, anchor, ...placement }) with a local PNG, JPEG, or animated GIF. Move an active sticker with setFaceStickerPlacement, read its state with isFaceStickerActive, and remove it with clearFaceSticker. Supported anchors include center, forehead, aboveHead, leftEye, rightEye, eyes, nose, mouth, and chin. A face sticker shares the AR overlay slot, so applying another AR effect replaces it.
Eye and hair colouring
setEyeColor(color, intensity) and setHairColor(color, intensity) return Promise<void> and use normalized red, green, and blue. Intensities use 0...1; invalid values reject. Update via the matching set...ColorIntensity method, query isEyeColorActive / isHairColorActive, and remove with removeEyeColor / removeHairColor. These are configured layer states, not detection callbacks. See Eye and hair colouring.
Active effects and events
Read getActiveEffects() and register addActiveEffectsChangedListener for typed NosmaiActiveEffects snapshots. Package paths can be absent while built-in beauty or a sticker is active; use hasBuiltInBeauty, isFaceStickerActive, isHairColorActive, and effective background fields instead of relying only on path presence.
Licence, error, download, recording-progress, game, and analysis-frame events have separate add...Listener methods. Each returns a subscription with remove(). Recording progress is elapsed seconds, not finalization. See Active effects and events.
Media and frames
capturePhoto, recording methods, progress listeners, and gallery-save helpers return file URI based results.startFrameStream,getLatestFrame,stopFrameStream, and frame listeners provide bounded analysis sampling. They are not a high-rate streaming bridge.
startRecording() takes no encoder-config argument; stopRecording() returns a finalized temporary MP4 URI, durationSeconds, fileSizeBytes, MIME type, and hasAudio. The public wrapper has no bitrate/FPS/audio configuration setter. See Recording configuration. For native external-frame routing rather than low-rate analysis sampling, use an app-owned adapter and the documented native formats in Off-screen rendering.
Every add...Listener method returns a subscription. Remove it during screen cleanup to prevent duplicate handlers.