Asset
"A picture is worth a thousand words"
Therefore, images and other media files are often used in modern mobile applications. Assets are a possibility to provide these media files to the configuration. The assets can be bundled in the app during the build and are downloaded during the app start if changed. If all assets are availabe, the app can display all media items, even if it is offline.
Files
To add an asset to the configuration, simply add the file to the ./asset
directory. The name of the file must be unique since it will be used to refer to the asset. The asset directory is type agnostic. Any file can be added. To check which file types are supported, check the layers in which you want to use the assets.
Images are used as they are. It it makes sense to provide them in an expected size. Images that are too large, e.g. intended for printing, may not work and take up unneccessary storage space on the device.
Usage
Assets can be used in the following components:
- layers
- actions
To use an asset the URI requires the protocol asset
and the path is the file name.
Examples
The following examples show how assets are used in different layers and actions.
{
"type": "image",
"value": "asset://logo.png"
}
{
"type": "video",
"value": "asset://intro.mp4"
}
{
"type": "playAudio",
"param": {
"url": "asset://intro.mp4"
}
}