Skip to main content

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.

Download audio#

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 AssetConfig#

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 AssetConfig. The AudioTrackAsset takes in a unique identifier, an AudioSource, and optionally the title, artist, and duration in seconds.

Create categories#

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.

The 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.

Configure UiConfigAudio#

Here, we configure UiConfigAudio and set the audio track lists.