Search...
onPlay( )
Adds an event handler that runs when playback is started or restarted.
Description
An audio track can be played by a user clicking the audio player's
play button or by calling its play()
function.
Syntax
function onPlay(handler: EventHandler): AudioPlayerhandler: function EventHandler(event: Event): void
onPlay Parameters
NAME
TYPE
DESCRIPTION
handler
The name of the function or the function expression to run when the audio track is played.
EventHandler Parameters
NAME
TYPE
DESCRIPTION
Returns
This function does not return anything.
Return Type:
void
Related Content:
Was this helpful?
Get the ID of the audio player that is playing
Copy Code
1$w("#myAudioPlayer").onPlay( (event) => {2 let targetId = event.target.id; // "myAudioPlayer"3});