0

I want to use audio play and stop function rather than play and pause so my recording will automatically reset when ever I click on the button

<script>
    function aud_play_pause(abc) {
      var myAudio = document.getElementById(abc);
      if (myAudio.paused) {
        myAudio.play();
      } else {
        myAudio.pause();
      }
    } 

    document.addEventListener('play', function(e){
        var audios = document.getElementsByTagName('audio');
        for(var i = 0, len = audios.length; i < len;i++){
            if(audios[i] != e.target){
                audios[i].pause();
            }
        }
    }, true);

</script>
2
  • I am a new bee I am not very good in coding so I am taking help from this site. Please help me to edit my code because when I edit my code from aud_play_pause to aud_play_stop even the play button stops working Dec 30, 2015 at 18:13
  • Stack Overflow is not a good place to learn how to program. You should read a book, or take a course, for that. Stack Overflow is a good place for professionals and enthusiasts to get specific questions answered. Dec 30, 2015 at 18:47

0

Browse other questions tagged or ask your own question.