Skip to main content
VESDK/Android/Getting Started/Show Editor
Language:

Present Video Editor

Create SettingsList#

The VideoEditorSettingsList stores all the settings that are used to configure the video editor and its tools. The configure() method is used to configure the different ImglySettings models inside the SettingsList. Here, we configure the LoadSettings to set the source to the Uri of the video to be loaded.

Start Editor#

The VideoEditorBuilder takes in the configured VideoEditorSettingsList and starts the video editor. The resultId passed in the startActivityForResult() method is returned as requestCode in onActivityResult() when the editor exits.

Handle Result#

The result from the editor is received in the onActivityResult() method. EditorSDKResult wraps around the intent and provides a convenient API to check the status of the export.

File:
class ShowVideoEditor(private val activity: AppCompatActivity) : Example(activity) {
override fun invoke() {
// In this example, we do not need access to the Uri(s) after the editor is closed
// so we pass false in the constructor
val settingsList = VideoEditorSettingsList(false)
// Set the source as the Uri of the video to be loaded
.configure<LoadSettings> {
it.source = activity.resourceUri(R.raw.skater)
}
// Start the video editor using VideoEditorBuilder
// The result will be obtained in onActivityResult() corresponding to EDITOR_REQUEST_CODE
VideoEditorBuilder(activity)
.setSettingsList(settingsList)
.startActivityForResult(activity, EDITOR_REQUEST_CODE)
// Release the SettingsList once done
settingsList.release()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
intent ?: return
if (requestCode == EDITOR_REQUEST_CODE) {
// Wrap the intent into an EditorSDKResult
val result = EditorSDKResult(intent)
when (result.resultStatus) {
EditorSDKResult.Status.CANCELED -> showMessage("Editor cancelled")
EditorSDKResult.Status.EXPORT_DONE -> showMessage("Result saved at ${result.resultUri}")
else -> {
}
}
}
}
}