You could set a timeout (change the milisecondsif you want: 1000 )
function play() {
var audio = document.getElementById("audio");
audio.play();
setTimeout(function(){alert("Extraction is finished");},1000);
}