nosmai_camera_sdk 3.0.6
nosmai_camera_sdk: ^3.0.6 copied to clipboard
A Flutter plugin for Nosmai SDK - Real-time video filtering and beauty effects

Nosmai Camera SDK Flutter Plugin #
A Flutter plugin for integrating the Nosmai SDK with real-time camera preview, beauty effects, AR effects, LUT filters, recording, and local/cloud filter discovery.
Features #
- Real-time camera preview on Android and iOS
- Beauty controls such as smoothing, whitening, face shape, lipstick, blush, and eye makeup
.nosmaiAR effects and regular filter/LUT effects- Local production filter listing with manifest metadata
- Development-only loose
.nosmaifilter discovery - Cloud filter listing, pagination, download, and removal
- Front/back camera switching, photo capture, video recording, and gallery save
Platform Support #
| Platform | Status |
|---|---|
| iOS | iOS 15.0+, physical ARM64 device |
| Android | API 21+, ARM64 (arm64-v8a) device |
The iOS simulator is not supported. Camera, rendering, filters, and recording must be built and tested on a physical ARM64 iOS device.
Installation #
dependencies:
nosmai_camera_sdk: ^3.0.6
Setup #
iOS #
The plugin installs the proprietary NosmaiCameraSDK native dependency through
CocoaPods. Do not copy an iOS framework into the Flutter application manually.
Update ios/Podfile:
platform :ios, '15.0'
target 'Runner' do
use_frameworks! :linkage => :static
use_modular_headers!
flutter_install_all_ios_pods(File.dirname(File.realpath(__FILE__)))
end
Add permissions to ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app uses the camera to apply real-time filters.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app uses the microphone for video recording.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app saves photos and videos to your gallery.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app saves photos and videos to your gallery.</string>
Android #
The proprietary Android SDK is distributed separately and is not included in the pub.dev package.
- Download
nosmai-sdk-3.0.0.aarfrom the Android SDK v3.0.0 release. - Verify it with the release
SHA256SUMSfile. - Rename it to
nosmai-release.aarand place it atandroid/app/libs/nosmai-release.aar.
Add the local AAR repository to android/build.gradle:
allprojects {
repositories {
google()
mavenCentral()
flatDir { dirs "${rootProject.projectDir}/app/libs" }
}
}
For projects using Kotlin DSL, add the equivalent to
android/build.gradle.kts:
allprojects {
repositories {
google()
mavenCentral()
flatDir { dirs("${rootProject.projectDir}/app/libs") }
}
}
Add the native SDK to android/app/build.gradle:
dependencies {
implementation files('libs/nosmai-release.aar')
}
Kotlin DSL (android/app/build.gradle.kts):
dependencies {
implementation(files("libs/nosmai-release.aar"))
}
The current native SDK supports ARM64 Android devices (arm64-v8a).
Restrict the consuming app to the supported ABI in
android/app/build.gradle:
android {
defaultConfig {
ndk {
abiFilters "arm64-v8a"
}
}
}
Add permissions to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
Basic Usage #
import 'package:nosmai_camera_sdk/nosmai_camera_sdk.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
const licenseKey = String.fromEnvironment('NOSMAI_LICENSE_KEY');
if (licenseKey.isEmpty) {
throw StateError('NOSMAI_LICENSE_KEY is required');
}
await NosmaiFlutter.initialize(licenseKey);
runApp(const MyApp());
}
Pass the key at build or run time. Do not commit production keys to source control:
flutter run --dart-define=NOSMAI_LICENSE_KEY=YOUR_LICENSE_KEY
class CameraScreen extends StatelessWidget {
const CameraScreen({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: NosmaiCameraPreview(),
);
}
}
Applying Filters #
Use applyEffect for every external .nosmai package. The package manifest
routes filter, effect, beauty_effect, and background to the correct
native render slot.
final nosmai = NosmaiFlutter.instance;
await nosmai.applyEffect(filter.path);
applyFilter remains available only as a legacy compatibility alias.
Clear specific layers when needed:
await nosmai.clearFilter(); // regular filter only
await nosmai.clearAREffect(); // AR effect only
await nosmai.clearAll(); // AR, filter, beauty, and background
Local Filters #
The plugin and its example app do not ship any .nosmai filter binaries.
Add only the licensed filters owned by your application to the consuming app.
Production local filters should use the manifest-based folder structure:
assets/nosmai_filters/
glam_lips/
glam_lips_manifest.json
glam_lips_preview.png
glam_lips.nosmai
Declare each filter folder in pubspec.yaml:
flutter:
assets:
- assets/nosmai_filters/glam_lips/
- assets/nosmai_filters/soft_blush/
Load production filters:
final filters = await nosmai.getLocalFilters();
final grouped = await nosmai.getAllLocalFilters();
final effects = await nosmai.getLocalEffects();
final backgrounds = await nosmai.getLocalBackgrounds();
final beauty = await nosmai.getLocalBeautyEffects();
The plugin uses Flutter's supported AssetManifest API to discover declared
assets. It does not depend on the removed AssetManifest.json build file.
Debug Filters #
getDebugFilters is intentionally kept for development/testing. Use it when
you want to bundle loose .nosmai files directly, usually under
assets/filters/, without creating manifest and preview files.
flutter:
assets:
- assets/filters/
final allDebugFilters = await nosmai.getDebugFilters();
final debugEffects = await nosmai.getDebugFilters(
type: NosmaiLocalFilterType.effect,
);
For production apps, prefer the manifest-based local filter methods above.
Cloud Filters #
final allFilters = await nosmai.getCloudFilters();
final page = await nosmai.getCloudFilters(
filterType: NosmaiCloudFilterType.effects,
version: NosmaiCloudFilterVersion.v2,
page: 1,
limit: 20,
);
final beautyEffects = await nosmai.getCloudFilters(
filterType: NosmaiCloudFilterType.beautyEffect,
);
final pagination = nosmai.lastPaginationInfo;
version is optional. Cloud filter version 2 is used by default, so existing
getCloudFilters() calls remain unchanged.
Download and apply a cloud filter:
final result = await nosmai.downloadCloudFilter(filter.cloudIdentifier);
final path = result['path'] as String?;
if (path != null) {
await nosmai.applyEffect(path);
}
Camera Controls #
await nosmai.switchCamera();
final photo = await nosmai.capturePhoto();
if (photo.success) {
await nosmai.saveImageToGallery(photo.imageData!);
}
await nosmai.startRecording();
final recording = await nosmai.stopRecording();
if (recording.success && recording.videoPath != null) {
await nosmai.saveVideoToGallery(recording.videoPath!);
}
Lifecycle #
Use pauseCamera/resumeCamera for short tab changes where you want fast
return to the camera. Use cleanup when leaving the camera flow and releasing
native camera/GL resources.
await nosmai.pauseCamera();
await nosmai.resumeCamera();
await nosmai.cleanup();
Support #
- Plugin issues: GitHub Issues
- SDK documentation: https://docs-sdk.nosmai.com
- License registration: https://effects.nosmai.com/
License #
This plugin and its associated native SDKs are proprietary commercial software. Use, modification, redistribution, reverse engineering, or sublicensing is not permitted without written authorization from Nosmai. A valid license agreement and platform license key are required. See LICENSE.