I am dealing with dynamic loaded file from php. My custom audio control can only play the first audio file from the database but cannot play others. I will greatful if anyone can help me.
This is my code:
 echo " <audio id='aud' controls> 
      source='$aud_dir' type='audio/$audio_type'>
      </audio>
     <h4 id='playpausebtn'><span class='glyphicon glyphicon-play'></span>  </h4>";
This is my javascript code:
var aud, playbtn;
function intializeplayer() {
  aud = document.getElementById('aud');
  playbtn = document.getElementById('playpausebtn');
  playbtn.addEventListener('click', playpause, false);
}
window.onload = intializeplayer;
function playpause() {
  if (aud.paused) {
    aud.play();
  } else {
    aud.pause();
  }
}
 
     
     
    