From Remote URL
VideoEditor SDK supports loading overlays from a remote URL, this can be a resource hosted by a photo hosting provider or your servers. Although the editor supports adding assets with remote URLs, we highly recommend that you manage the download of remote resources yourself, since this gives you more control over the whole process.
Download overlay#
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.
Create OverlayAsset
#
OverlayAsset
#Here, we construct an OverlayAsset
object using the file downloaded above, providing it a unique id, blend mode, and intensity.
Add overlay to AssetConfig
#
AssetConfig
#To use the overlay, it must first be available in the SDK's backend. This is done by adding the overlay to the AssetConfig
.
Configure UiConfigOverlay
#
UiConfigOverlay
#Here, we configure UiConfigOverlay
and add a custom OverlayItem
to the overlayList
. Note how the OverlayItem
uses the same id as the OverlayAsset
. We also provide a name and a thumbnail ImageSource
for the overlay.