In this example, we will show you how to make basic configurations for the mobile editor.
Configuration#
The basic configuration settings shown here are passed directly to Editor.
license- the license to activate the Engine with.
license = null, // pass null or empty for evaluation mode with watermarkuserId- an optional unique ID tied to your application’s user. This helps us accurately calculate monthly active users (MAU). Especially useful when one person uses the app on multiple devices with a sign-in feature, ensuring they’re counted once. Providing this aids in better data accuracy. The default value isnull.
userId = "<your unique user id>",baseUri- is used to initialize the engine’sbasePathsetting before the editor’sonCreatecallback is run. It is the foundational URI for constructing absolute paths from relative ones. For example, setting it to the Android assets directory allows loading resources directly from there:file:///android_asset/. This URI enables the loading of specific scenes or assets using their relative paths. The default value is pointing at the versioned IMG.LY CDN but it should be changed in production environments.
baseUri = "file:///android_asset/".toUri(),engineRenderTarget- the target which should be used by the Engine to render. The engine is able to render on both SurfaceView and TextureView. The default value isEngineRenderTarget.SURFACE_VIEW.
engineRenderTarget = EngineRenderTarget.SURFACE_VIEW,Full Code#
Here’s the full code:
import androidx.compose.runtime.Composableimport androidx.core.net.toUriimport androidx.navigation.NavHostControllerimport ly.img.editor.Editorimport ly.img.editor.core.engine.EngineRenderTarget
// Add this composable to your NavHost@Composablefun BasicEditorSolution(navController: NavHostController) { Editor( license = null, // pass null or empty for evaluation mode with watermark userId = "<your unique user id>", baseUri = "file:///android_asset/".toUri(), engineRenderTarget = EngineRenderTarget.SURFACE_VIEW, ) { // You can set result here navController.popBackStack() }}