Search...
onEnded( )
Adds an event handler that runs when playback has ended.
Description
An audio track ends when playback reaches the duration
of the audio.
If the audio track is set to play in a loop, this event handler is never triggered.
Syntax
function onEnded(handler: EventHandler): AudioPlayerhandler: function EventHandler(event: Event): void
onEnded Parameters
NAME
TYPE
DESCRIPTION
handler
The name of the function or the function expression to run when the audio track has ended.
EventHandler Parameters
NAME
TYPE
DESCRIPTION
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
Get the ID of the audio player whose audio track has ended
Copy Code
1$w("#myAudioPlayer").onEnded( (event) => {2 let targetId = event.target.id; // "myAudioPlayer"3});