Skip to main content
VESDK/Android/Guides/Video Composition
Language:

Configure Video Composition

VideoEditor SDK supports several configuration options for the VideoCompositionToolPanel allowing flexible adaptation to different needs and use cases.

allowAddVideoClips#

By default, the video composition tool allows adding more video clips via the video library or the gallery. It opens the video library if it is included in your subscription and has video clips. Otherwise, it opens the gallery for adding video clips to the composition.

To disable adding video clips, set UiConfigComposition.allowAddVideoClips to false.

videoClipLists#

Here, we add our custom video clips for the video library. We also add the VideoClipAddItem in this example to allow picking video clips from the gallery.

VideoClipCategoryItem is used to create categories of video clips. A VideoClipItem represents a single video clip and takes in a VideoSource for the video. The thumbnail of this video is automatically generated from the video itself. Alternatively, you can pass your own ImageSource to the VideoClipItem for a custom thumbnail.

In this example, we create VideoSource from videos present in the local resources. However, it can also be created using a File or a Uri.

File:
class CompositionConfiguration(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)
}
settingsList.configure<UiConfigVideoLibrary> {
it.setVideoClipLists(
VideoClipAddItem(),
VideoClipCategoryItem(
"video_misc_category",
"Misc",
VideoClipItem(VideoSource.create(R.raw.delivery)),
VideoClipItem(VideoSource.create(R.raw.notes))
),
VideoClipCategoryItem(
"video_people_category",
"People",
VideoClipItem(VideoSource.create(R.raw.dj)),
VideoClipItem(VideoSource.create(R.raw.rollerskates))
)
)
}
// 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 -> {
}
}
}
}
}