JSFiddle - React, Tailwind, and code Playground
HTML
<audio id="audio2"
preload="auto"
src="http://upload.wikimedia.org/wikipedia/commons/a/a9/Tromboon-sample.ogg" >
<p>Your browser does not support the audio element</p>
</audio>
<script>
// set start and end times
var startTime = 12;
var endTime = 15;
myAudio=document.getElementById('audio2');
myAudio.addEventListener('canplaythrough', function() {
// start it at the start time
this.currentTime = startTime;
this.play();
// let it play to the end time and then reset the play time
setTimeout(function(){
this.currentTime = startTime;
}, (endTime-startTime)*1000)
});
</script>