Entry points
| Type | Purpose |
|---|---|
NosmaiSDK | Initialization, processing, package slots, games, recording, and off-screen output |
NosmaiPreviewView | GPU preview, Camera2 input surface, lifecycle, recording surface, and texture callbacks |
NosmaiBeauty | Beauty, colour, makeup, reshape, eye colour, hair colour, and manual backgrounds |
NosmaiCloud | Licensed cloud catalog, pagination, cache state, download, and progress |
NosmaiEffects | Authored package metadata, runtime parameter controls, and game interaction |
Initialize and process
| API | Result |
|---|---|
NosmaiSDK.initialize(context, licenseKey) | Initializes the process-wide native runtime |
NosmaiSDK.isInitialized() | Reports whether initialization was accepted |
NosmaiSDK.startProcessing(previewView) | Connects processing to a prepared NosmaiPreviewView |
NosmaiSDK.stopProcessing() | Stops processing while preserving the initialized runtime |
NosmaiSDK.cleanup() | Releases process-wide SDK resources |
NosmaiPreviewView.onResume() / onPause() | Mirrors the owning Activity or Fragment lifecycle |
Apply and clear packages
| API | Notes |
|---|---|
NosmaiSDK.applyEffect(path) | Applies a readable local .nosmai package |
NosmaiSDK.setAREffect(path) / clearAREffect() | Controls the AR-effect slot |
NosmaiSDK.setFilter(path) / clearFilter() | Controls the filter slot |
NosmaiSDK.clearAllEffects() | Clears all active effect state |
NosmaiSDK.removeAllEffects() | Compatibility alias for the full clear operation |
Apply package mutations serially and check the returned boolean. Do not pass a URL, cloud identifier, query string, or partial download to a path method.
Runtime parameters
Use NosmaiEffects.getEffectParameters() after applying an authored package. Update numeric, integer, or Boolean controls with setEffectParameter(name, float) and text controls with setEffectParameter(name, String). Read numeric values with getEffectParameterValue(name) and treat Float.NaN as unavailable. Parameter names, types, ranges, and options belong to the active package.
Cloud Filters
Call NosmaiCloud.isEnabled() before showing cloud-only controls. Use NosmaiCloud.fetch(query), inspect NosmaiCloud.list() and NosmaiCloud.pagination(), then call NosmaiCloud.download(filterId, ...). The download callback returns the verified local path that can be passed to NosmaiSDK.applyEffect(path). NosmaiCloud.cachedList() reports the SDK cache; lastError() provides a public diagnostic without exposing service routes.
Beauty and backgrounds
NosmaiBeauty exposes skin smoothing, skin whitening, teeth whitening, sharpening, brightness, contrast, RGB, hue, saturation, exposure, white balance, grayscale, eye colour, makeup layers, reshape controls, hair colour, background blur, background image, and background colour. Use the documented value range for the selected method and use the matching remove or clear method instead of clearing unrelated package slots.
Games, recording, and output
isGameReady(),sendGameTap(x, y),sendGameInput(...), game lifecycle, and game-event listeners control an active game package.startRecording(preview, outputPath, callback)andstopRecording(callback)manage processed recording.setTextureListener,setTextureFrameCallback, and external I420 methods support app-owned output pipelines. Release stream slots after consumption.
Ownership rules
Keep one Camera2 owner and one NosmaiPreviewView per active session. Stop the previous camera before navigating to a second camera screen. Run lifecycle and view operations on the Android main thread and keep high-rate texture work out of Java object-conversion paths.