JavaScript Method




The source of the audio file to play, the player will choose the first source it can play if the source is an array.


Load an audio file to play.

Example: Loading an Audio File into the AudioPlayer Control

You can dynamically load an audio file into the AudioPlayer control in the UX Component using the load() method on the _play object of the AudioPlayer control's JavaScript object. For example:

// Get the object for the AudioPlayer Control:
var audioObj = {dialog.object}.getControl('AUDIOPLAYER');
var audioFile = "";

if (audioObj) {
    // the audio player class object is stored in the _play
    // property of the AudioPlayer Control's JavaScript object:
The AudioRecorderAndPlayer control's JavaScript object also has a _play property containing methods for the audio player class.

Using load() to set the audio file, however, is not necessary. Because the AudioPlayer control is a Data Control in the UX Component, you can use {dialog.object}.setValue() to load an audio file instead of the load() method. EG:

var audioFile = "";

See Also