<html>
<body>
<script>
function myFunction() {
alert("Can play through audio without stopping");
}
</script>
<audio controls oncanplaythrough="myFunction()">
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</body>
</html>