Skip to main content

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

FeatureDescription
Play / stopUse the status value to control whether audio plays or stops.
Loop playbackTurn loop on and playback repeats from the seek position once it finishes.
Volume, rate, and balanceAdjust loudness, playback speed, and left-right audio balance with volume, playBackRate, and balance.
Start positionUse seek to set the start position as a percentage (%) of the total length.
Built-in UITurn showUi on to show the play/pause and 10-second skip buttons along with the progress slider.
Background behaviorUse playBackgroundOption to stop, pause, or keep playing when the app goes to the background.

How to use

  1. Open the Contents category in the left widget palette.
  2. Drag and drop the Audio item onto the canvas.
  3. In the Properties panel on the right, point the audio property at the audio source you want to play — an asset or a URL.
  4. Adjust volume, loop, playBackRate, balance, and others as needed.
  5. Set status to Play and playback starts.

Properties

PropertyDescriptionDefaultValues / type
audioAudio source to play (an asset or a URL)None (empty source)Audio source
showUiWhether to show the built-in player UI (buttons and slider)truetrue/false (bool)
statusPlayback statusStopStop, Play
loopWhether to loop playbackfalsetrue/false (bool)
volumePlayback volume0.5Number 0.0 ~ 1.0
seekPlayback start position (% of the total length)0Integer 0 ~ 99
playBackRatePlayback speed multiplier1.0Number 0.5 ~ 2.0
balanceLeft-right audio balance0.0Number -1.0 ~ 1.0
playBackgroundOptionPlayback behavior when the app goes to the backgroundDisableDisable, DisablePause, Enabled

Notes and tips

warning

If the audio source is empty — an empty URL — nothing plays. Set an audio source on the audio property before you expect sound.

tip

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

tip

For the full set of Widget Control members (Property, Method, and Event) that drive this widget from a script, see Audio Widget Control.