Entry points
| Type | Purpose |
|---|---|
NosmaiSDK | Primary camera, processing, package, background, local catalog, cache, and off-screen API |
NosmaiCamera | Camera attachment, capture lifecycle, switching, focus, exposure, zoom, torch, and recording |
NosmaiEffectsEngine | Effects, Cloud Filters, games, beauty, makeup, runtime parameters, and pipeline state |
NosmaiCore | High-level initialization, status, photo capture, recording, pause, resume, and diagnostics |
Import the umbrella header:
#import <NosmaiCameraSDK/Nosmai.h>
Initialize and process
| API | Result |
|---|---|
+[NosmaiSDK initWithLicense:] | Creates the process-wide SDK or returns nil when startup is rejected |
+[NosmaiSDK sharedInstance] | Returns the initialized shared instance |
-[NosmaiSDK configureCameraWithPosition:preset:] | Configures the internal camera before processing |
-[NosmaiSDK setPreviewView:] | Attaches or detaches the preview container |
-[NosmaiSDK startProcessing] | Starts camera-frame processing |
-[NosmaiSDK stopProcessing] | Stops processing without destroying the instance |
-[NosmaiSDK cleanup] | Releases SDK resources; create a new instance before reuse |
Use NosmaiDelegate to observe state, errors, detected faces, filters, external frame completion, and license-status changes.
Apply and clear packages
| API | Notes |
|---|---|
applyEffect:completion: | Applies a readable local .nosmai package asynchronously |
applyEffectSync:error: | Synchronous variant; avoid calling it on a latency-sensitive UI path |
setFilter: / clearFilter | Controls the filter slot |
setAREffect: / clearAREffect | Controls the AR-effect slot |
removeAllFilters | Clears filter packages |
removeAllEffects | Clears the complete effect pipeline |
getEffectParameters | Returns parameters authored by the active package |
setEffectParameter:value: | Updates a numeric parameter by its authored name |
setEffectParameter:stringValue: | Updates a text parameter by its authored name |
getEffectParameterValue: | Reads a numeric value; a missing value returns NAN |
Local and Cloud Filters
Use getFilters, getFiltersOfType:, getLocalFilters, getLocalEffects, getLocalBackgrounds, getLocalBeautyEffects, and getLocalGames for local discovery. Cloud operations use getCloudFiltersWithOptions:, downloadCloudFilter:progress:completion:, isCloudFilterDownloaded:, getCloudFilterLocalPath:, and removeCloudFilter:.
Pass the unchanged downloaded local path to applyEffect:completion:. A cloud record identifier is not a filesystem path.
Beauty, makeup, and backgrounds
The SDK exposes skin smoothing, whitening, sharpening, teeth whitening, brightness, contrast, RGB, hue, white balance, HSB, eye colour, makeup layers, and signed reshape controls. Manual backgrounds use setBackgroundBlurEnabled:, setBackgroundBlurStrength:, setBackgroundImage:, setBackgroundColor:, setBackgroundVideo:, and their matching clear methods. Check isBeautyEffectEnabled, isCloudFilterEnabled, and isAdvancedFiltersEnabled before exposing gated controls.
Games and media
isGameReady,sendGameTapAtNormalizedX:y:,sendGameInput:x:y:value:,pauseGame,resumeGame, andrestartGamecontrol an active game package.capturePhoto:returns processed image data through the high-level core.startRecordingandstopRecordingmanage processed recording.setCVPixelBufferCallback:exposes processed output; use the off-screen APIs for an app-owned streaming pipeline.
Threading and ownership
Perform preview and camera UI work on the main thread. Keep one active camera owner. Serialize package mutations instead of applying and clearing from multiple queues at once. Stop or finalize media work before cleanup.