Skip to main content
Version: 4.64

Asset

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.

./asset/
└── logo.png

To reference an asset, use asset:// followed by the filename.

{
"type": "image",
"value": "asset://logo.png"
}
The app showing an image layer using the logo.png asset.The app showing an image layer using the logo.png asset.

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.

./asset/
└── cat.jpg
{
"type": "image",
"value": "asset://cat.jpg"
}
The app showing an image layer using the cat.jpg asset.The app showing an image layer using the cat.jpg asset.

In a video layer​

Use the gettingStarted.mp4 asset in a video layer.

./asset/
└── gettingStarted.mp4
{
"type": "video",
"value": "asset://gettingStarted.mp4"
}
The app showing a video layer using the gettingStarted.mp4 asset.The app showing a video layer using the gettingStarted.mp4 asset.

In a playAudio action​

Use the intro.mp3 asset in a playAudio action.

./asset/
└── intro.mp3
{
"type": "playAudio",
"param": {
"url": "asset://intro.mp3"
}
}

Troubleshooting​

If an asset does not work as expected, check the following:

  1. Is the asset stored in the ./asset directory?
  2. Is the asset filename spelled correctly?
  3. Does the reference use the asset:// prefix?
  4. Is the file type supported by the layer or action in which the asset is used?
  5. Is the asset available in the current configuration?