About Audio components

The Audio component is used to add audio files, such as MP3, WAV, and other formats depending on the capabilities of the web browser.

You can add an Audio component to a form and define its behavior in either designer (Web Designer in the web client, Design Mode in the Windows client). However, these components are only functional in the web client.

Component properties

Use these properties to set up or modify how the components display or behave:

Property Description
Data Source > Binding Use the Binding property to add the audio file and to start or stop playing the file.
  • To add the file, specify the URL to the audio file or a data-URI that contains the entire file. For example:
    • Content/audio/mySound.mp3
    • data:audio/mp3;base64,//uQZAAAAAAAAAAAAAAAAA …
  • To start or pause playing the audio file, specify its URL or data-URI in the initialization string.
    • An empty string value pauses the playing of the file.
    • A non-empty string value starts or resumes playing the file. For example, NEWGUID() and the full syntax: SETCOMPVALUES(MyAudioUserComp1=NEWGUID())
      Note: The ReadOnly/Disable property must be enabled to play the audio file.
Behavior > Hidden Use this property to hide or display the component.

The default value is False, which means the component displays/plays.

You must also set up the initialization string to display the audio player controls. If the component is set as visible, but has no controls, it displays an empty region.

Behavior > ReadOnly/Disable

OR

Behavior > Enabled When

Use this property to play the audio file.

The default value is False. If set to True, the start and stop functions of the player controls are enabled.

Note: When player controls are displayed, its functions are automatically enabled without enabling this property.
Miscellaneous > Specific Attributes > User Component Initialization String Use this property to set up the component initialization string.

Initialization string

In the User Component Initialization String property, specify the initialization string. Follow this format:

{"loop":value, "controls":value, "source":value}

Use these values:

String Value
loop The default value is false. If set to true, the audio file continuously loops and replays.

The audio file can be paused and restarted while in a continuous loop.

controls The default value is false. If set to true, the browser-specific player controls, such as play, pause, and volume options are displayed.
Note: The Hidden property must be disabled to display the player controls.

When player controls display, its functions are always enabled.

source The default value is blank. To start or play the audio file, specify the audio file's URL or data-URI.
Possible scenarios:
  • Empty string: { }

    If you enable the component and load the bound data with a valid audio URL or data-URI, the audio file will start to play as early as possible.

  • controls string only: {"controls":true}

    The player controls display. If you enable the component and load the bound data with a valid audio URL or data-URI, the audio file will start to play as early as possible.