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 own servers.
Download remote resource#
For each audio clip, we construct a remote URL from the clip identifier and create a download promise using the
expo-file-system module. Upon successful download, we save it to a temporary location.
Create Audio Clips#
Once the audio files have been downloaded, we iterate over them and create valid
AudioClip objects. Each of the clips needs an
identifier as well as an
audioURI. Optionally, you can also add a
artist and a title. If these are not specified, the SDK tries to fetch the relevant information from the clip's metadata.
Add to Configuration#
The previously created
AudioClips can now be added to custom
AudioClipCategory objects that are passed to the
Configuration. Each category needs an
name, an optional
thumbnailURI and optional
items - an array of
Handle user interaction#
For this example, we are disabling user interaction while the download task is executing. In production, you might want to indicate download progress here. When the download has finished, we can reenable user interaction and dismiss the progress indicator.