banuba_arcloud 1.0.0 banuba_arcloud: ^1.0.0 copied to clipboard
Our AR Cloud service enables your app to connect with our servers and access AR effects directly from the cloud.
Banuba ARCloud plugin #
AR Cloud is a client-server solution that helps to save space in your application. This is a product used to store AR filters i.e. masks on a server-side instead of the SDK code. After being selected by the user for the first time, the filter is going to be downloaded from the server and then saved on the phone's memory.
Installing #
To use this plugin, add banuba_arcloud
as a dependency in your pubspec.yaml file:
banuba_arcloud:
git:
url: git@bitbucket.org:BanubaLimited/arcloud-flutter.git
ref: 0.0.6
Now in your Dart
code, you can use:
import 'package:banuba_arcloud/banuba_arcloud.dart';
Platform specific configuration #
Android #
- Copy dependencies into your app module level
build.gradle
:
implementation 'com.banuba.sdk:ar-cloud:1.19.0'
- Add
FlutterArCloudKoinModule()
with your custom modules when initializing Koin:
class App : Application() {
override fun onCreate() {
super.onCreate()
startKoin {
androidContext(this@App)
modules(
FlutterArCloudKoinModule().modules.plus(MainKoinModule().module),
)
}
}
}
More information about Banuba android sdk.
iOS #
No special setup needed.
More information about Banuba iOS sdk.
Usage #
Use BanubaArcloudPlugin
to work with the plugin:
final _arcloudPlugin = BanubaArcloudPlugin();
Before you start using plugin you should provide your arCloudUrl
to init()
function:
_arcloudPlugin.init(arCloudUrl: 'https://example.com');
Don't forget to dispose plugin:
_arcloudPlugin.dispose();
Loading a list of effects. ArcloudEffectsLoadingException
is thrown when an error occurs while loading effects. ArcloudUnknownException
is thrown when something went wrong.
final effects = await _arcloudPlugin.getEffects();
Downloading the effect. ArcloudEffectDownloadingException
thrown when on error while downloading an effect. ArcloudUnknownException
is thrown when something went wrong.
await _arcloudPlugin.downloadEffect(effect.name);
You can also listen to stream effects. The data in it is emitted after downloading the effect. Don't forget to catch exceptions. ArcloudEffectsLoadingException
and ArcloudUnknownException
are thrown here.
_effectsStreamSubscription = _arcloudPlugin.getEffectsStream().listen(
_onEffectsLoaded,
onError: (e) => _showMessage(e.toString()),
);
See the sample for more information on using the plugin.
Enjoy!