From Remote URL
VideoEditor SDK supports loading audio files from a remote URL, this can be a resource hosted by a hosting provider or your servers.
For each remote resource, we create a
File in the cache directory and download the remote resource. Since file handling and downloading are IO operations, we do this inside a coroutine using the IO dispatcher.
Add audio assets to
To use the audio clips, they must first be available in the SDK's backend. This is done by adding the audio assets to the
AudioTrackAsset takes in a unique identifier, an
AudioSource, and optionally the title, artist, and duration in seconds.
We then add the audio clips to an
AudioTrackCategoryItem object that holds the metadata of the category such as a unique identifier, title, and optionally a preview image.
AudioTrackItem uses the same identifier as the one specified when creating the corresponding
AudioTrackAsset. It also optionally takes an
ImageSource that is used to display its thumbnail.
Here, we configure
UiConfigAudio and set the audio track lists.