Skip to content

Configuration

In this example, we will show you how to make basic configurations for the mobile editor. The example is based on the Design Editor, however, it is exactly the same for all the other solutions.

Configuration

The openEditor function allows for some further basic configuration of the editor.

Editor Settings

All the basic configuration settings are part of the EditorConfiguration which is required to initialize the editor.

const settings = new EditorSettingsModel({
license: 'YOUR_LICENSE_KEY',
sceneBaseUri: 'YOUR_SCENE_BASE_URI',
assetBaseUri: 'YOUR_ASSET_BASE_URI',
userId: 'YOUR_USER_ID'
});
  • license - the license to activate the Engine with.
license: 'YOUR_LICENSE_KEY',
  • sceneBaseUri - is used to initialize the engine’s basePath setting before the editor’s onCreate callback is run. It is the foundational URL for constructing absolute paths from relative ones. This URL enables the loading of specific scenes or assets using their relative paths.
sceneBaseUri: 'YOUR_SCENE_BASE_URI',
  • assetBaseUri - is used to initialize the default assets for the asset library.
assetBaseUri: 'YOUR_ASSET_BASE_URI',
  • userID - 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 is nil.
userId: 'YOUR_USER_ID'

Source

  • source - is used to load in a custom source, e.g. a scene, image or video file.
const source = require('MY_CUSTOM_SOURCE');

EditorPreset

  • preset - is used to determine which predefined editor variant you want to use - if any.
const preset: EditorPreset = EditorPreset.DESIGN;

Metadata

  • metadata - can be used to provide any custom { [key: string]: unknown } to the underlying native plugin which you can use for further custom handling.
const metadata = {
MY_KEY: 'MY_VALUE'
};

Full Code

import IMGLYEditor, {
EditorPreset,
EditorSettingsModel,
} from '@imgly/editor-react-native';
export const basicEditor = async (): Promise<void> => {
const settings = new EditorSettingsModel({
license: 'YOUR_LICENSE_KEY',
sceneBaseUri: 'YOUR_SCENE_BASE_URI',
assetBaseUri: 'YOUR_ASSET_BASE_URI',
userId: 'YOUR_USER_ID',
});
const source = require('MY_CUSTOM_SOURCE');
const preset: EditorPreset = EditorPreset.DESIGN;
const metadata = {
MY_KEY: 'MY_VALUE',
};
const result = await IMGLYEditor?.openEditor(
settings,
source,
preset,
metadata,
);
};