The Audio element is for playing audio.

Audio support varies between operating systems. To ensure your project works on all platforms, try to only use common audio formats like WAV and MP3.

Item {
    on Gesture.tapped(point) {
// Audio declared outside the visual code
Audio as audioExample {
    source: "ding.m4a"

property Bool enabled: true

When true, the Audio element is enabled and will preroll its audio and respond to other commands, like play().

You might disable audio when you want to control exactly when it begins loading and consuming resources.

property Audio.Status statusread only

The status of the Audio.


The element is disabled, or there is no source specified.


The element is loading the audio source.


The element has successfully loaded the audio, and is ready for playback.


The element has failed to load the audio source.

property Url source

The audio's source url. This may be a local file in your project, or a network URL.

If you specify a video file as the source, the video's audio track will be played.

Audio {
    source: "ding.m4a"

property Bool playingread only

property Bool pausedread only

True when the audio is playing and when it is paused.

property Float timeread only

property Float durationread only

The current play time, and the total duration of the audio in seconds.

You can change the play time by calling the seekTo() method.

property Float volume: 1.0

The volume at which to play the audio, from 0.0 which mutes the audio to 1.0 which plays it at maximum volume.

property Audio.AudioCategory category: .Ambient

Controls how the audio affects background music apps the user has running, such as the Apple Music or Spotify apps.


The audio is mixed with the background music.


Background music is paused when this Audio element plays.

In both cases, the Audio is silenced if the user locks their device or exits the app.

function play()

function pause()

function stop()

function seekTo(Float seconds)

Play, pause, stop and seek the audio.