Audio
The Audio widget is a player for audio files.
It comes with a built-in UI: play and pause buttons, buttons that skip 10 seconds back and forward, and a playback position slider.
Definition and role
The Audio widget plays the audio source you give it — an asset or a URL. Set the volume, playback rate, left-right balance, looping, and start position, and choose how playback behaves when the app moves to the background.
- Category: Contents
- Built-in UI: play/pause buttons, buttons that skip 10 seconds back and forward, and a playback position slider
- Default volume:
0.5 - Default playback status:
Stop
Features
| Feature | Description |
|---|---|
| Play / stop | Use the status value to control whether audio plays or stops. |
| Loop playback | Turn loop on and playback repeats from the seek position once it finishes. |
| Volume, rate, and balance | Adjust loudness, playback speed, and left-right audio balance with volume, playBackRate, and balance. |
| Start position | Use seek to set the start position as a percentage (%) of the total length. |
| Built-in UI | Turn showUi on to show the play/pause and 10-second skip buttons along with the progress slider. |
| Background behavior | Use playBackgroundOption to stop, pause, or keep playing when the app goes to the background. |
How to use
- Open the Contents category in the left widget palette.
- Drag and drop the Audio item onto the canvas.
- In the Properties panel on the right, point the
audioproperty at the audio source you want to play — an asset or a URL. - Adjust
volume,loop,playBackRate,balance, and others as needed. - Set
statustoPlayand playback starts.
Properties
| Property | Description | Default | Values / type |
|---|---|---|---|
audio | Audio source to play (an asset or a URL) | None (empty source) | Audio source |
showUi | Whether to show the built-in player UI (buttons and slider) | true | true/false (bool) |
status | Playback status | Stop | Stop, Play |
loop | Whether to loop playback | false | true/false (bool) |
volume | Playback volume | 0.5 | Number 0.0 ~ 1.0 |
seek | Playback start position (% of the total length) | 0 | Integer 0 ~ 99 |
playBackRate | Playback speed multiplier | 1.0 | Number 0.5 ~ 2.0 |
balance | Left-right audio balance | 0.0 | Number -1.0 ~ 1.0 |
playBackgroundOption | Playback behavior when the app goes to the background | Disable | Disable, DisablePause, Enabled |
Notes and tips
If the audio source is empty — an empty URL — nothing plays. Set an audio source on the audio property before you expect sound.
seek is a percentage of the total length (0~99), not a number of seconds. Turn loop on and playback repeats from this position every time it finishes.
Learn more
For the full set of Widget Control members (Property, Method, and Event) that drive this widget from a script, see Audio Widget Control.