JavaScript

A5.audio.Playerplay Method

Syntax

A5.audio.Player.play()

Description

Play the audio. This will start audio playing from the current time. If the current time is at the end of the audio, audio will start playing from the beginning.

Example: Playing the AudioPlayer Control 

The UX Component AudioPlayer control's JavaScript object can be used to control the audio playback on the client. The _play property of the object contains the audio player class methods. The JavaScript below demonstrates how to play the audio playback for an AudioPlayer control:

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

if (audioObj) {
    audioObj._play.play();
}
The AudioRecorderAndPlayer control's JavaScript object also has a _play property containing methods for the audio player class.
On some devices audio playback cannot be started programatically and the A5.audio.Player.play() method must therefore be called from the context of a user event, such as "onclick" or "ontouchstart".

See Also