JSFiddle - React, Tailwind, and code Playground
HTML
<button id="audioControl" style="width:35px;height:30px;"></button>
<audio id="aud" src="http://daokun.webs.com/play0.mp3" type="audio/mpeg" autoplay autobuffer />
JavaScript
$(document).ready(function() {
$("button").button();
$('#audioControl').html('II');
});
var aud = document.getElementById('aud'),
count = 0;
$('#audioControl').toggle(
function () {
aud.pause();
$('#audioControl').html('>');
},
function () {
aud.play();
$('#audioControl').html('II');
}
);
var self = this;
this.next = function (){
count++;
if(count == 2){count = 0;}
aud.src = 'http://daokun.webs.com/play'+count+'.mp3';
};
aud.addEventListener("ended", function() {
self.next();
self.play();
});