Assets provide a way to make media files available to the configuration. Assets can be bundled in the app during the build. If all assets are available, the app can display media items even when the app is offline.
Quick guide
Assets are stored in the ./asset directory.
To reference an asset, use asset:// followed by the filename.
{
"type": "image",
"value": "asset://logo.png"
}
Asset files
The asset filename must be unique because it is used to refer to the asset.
./asset directory
To add an asset to the configuration, add the file to the ./asset directory.
The asset directory is type agnostic, so any file can be added. The supported file types depend on the layer or action in which the asset is used.
File size
Assets are used as provided. It is recommended to provide them in the size in which they are expected to be displayed.
Using assets
To use an asset, use asset:// followed by the filename, e.g. asset://logo.png.
Components using assets
Assets can be used in the following components:
Layers
Actions
In an image layer
Use the cat.jpg asset in an image layer.
{
"type": "image",
"value": "asset://cat.jpg"
}
In a video layer
Use the gettingStarted.mp4 asset in a video layer.
./asset/
└── gettingStarted.mp4
{
"type": "video",
"value": "asset://gettingStarted.mp4"
}
In a playAudio action
Use the intro.mp3 asset in a playAudio action.
{
"type": "playAudio",
"param": {
"url": "asset://intro.mp3"
}
}
Troubleshooting
If an asset does not work as expected, check the following:
- Is the asset stored in the
./asset directory?
- Is the asset filename spelled correctly?
- Does the reference use the
asset:// prefix?
- Is the file type supported by the layer or action in which the asset is used?
- Is the asset available in the current configuration?