Use the HTML DOM to assign an "onended" event to an audio element.
Press play and wait for the audio to end.