Audio Composition
The VideoEditor SDK supports adding predefined audio libraries from which an audio clip can be overlayed on top of the video's soundtrack.
Inside the audio tool, the audio clip can be trimmed and balanced with the original soundtrack of the video.
The corresponding tool is implemented in the AudioOverlayOptionsToolPanel
class and can be customized using the UiConfigAudio
configuration.
Adding audio clips#
Audio Tracks are inserted into the SDK using the UiConfigAudio
.
An AudioTrackCategoryItem
object holds the metadata of an audio clip category, such as its preview image and the title and has an array of AudioTrackItem
objects,
which references via ID to the AudioTrackAsset
holding the metadata such as its AudioSource
, title, artist, and duration. The AudioSource
class is not optimized to handle remote resources which therefore should be downloaded in advance and then passed as a local resource.
// Add AssetssettingsList.config.addAsset(// Takes title, artist and artwork from the MetadataAudioTrackAsset("id_track_my", AudioSource.create(R.raw.track_trapped_in_the_upside_down)),// Overrides, title, artist and duration -> faster loading speedAudioTrackAsset("id_track_fancy", AudioSource.create(Uri.fromFile(downloadedFile)), title = "New Title", artist = "New Artist", durationInSeconds = 126),AudioTrackAsset("id_track_summer", AudioSource.create(downloadedUri)),)settingsList.configure<UiConfigAudio> {it.setAudioTrackLists(AudioTrackCategoryItem("audio_cat_elsewhere", "Elsewhere",// Artist picture is taken from the metadataAudioTrackItem("id_track_my"),AudioTrackItem("id_track_summer"),// Overrides the artist pictureAudioTrackItem("id_track_fancy", ImageSource.create(R.drawable.pictogram)),))}