Create the SDK
NosmaiWebSDK.create(options) creates and initializes the preview. The options require a target canvas and may include camera, renderer, face tracking, segmentation, licensing, package-loader limits, and callbacks. Use the authorized preview package supplied by Nosmai; no public npm install command is currently documented.
Lifecycle
| API | Purpose |
|---|---|
initialize() | Moves an idle instance to ready state |
startCamera(options?) | Requests the browser camera and starts the render loop |
switchCamera(options) | Restarts capture with the requested camera options |
pause() / resume() | Suspends or resumes rendering without replacing the instance |
stopCamera() | Stops media tracks and camera rendering |
destroy() | Releases camera, renderer, package, and inference resources permanently |
Packages and parameters
applyEffect(source) accepts an authorized package URL, Blob, ArrayBuffer, or Uint8Array and returns a compatibility-aware result. Inspect compatibility before enabling the effect in production. Use setParameter for a parameter declared by the active package and removeEffect() to unload it.
The preview does not expose native Cloud Filters. Your authorized application supplies the package source and must apply its own access and cache policy.
Runtime state
Read state, version, licenseStatus, runtimeCapabilities, latestFace, latestSegmentation, latestPassTriggers, and diagnostics. Diagnostics reports the selected renderer, inference delegates, timing values, hardware acceleration, and warnings. Do not treat a software renderer as equivalent to a production GPU path.
Licensing
verifyLicense(apiKey) updates the preview license state and watermark. isFeatureEnabled(featureName) reports current entitlement. License rejection does not intentionally destroy the Web preview; observe onLicenseStatus and onDiagnostic and keep keys outside browser source control.
Compatibility limits
Web support is a developer preview. A package may be partially renderable even when its type is generally supported. Treat CompatibilityReport.canRender, fullySupported, pass counts, and issues as the authority for the exact package. Test in the production browser, GPU, iframe, CSP, and camera-permission configuration.