Play multiple audio on iPad or touch devices

How to play multiple audio files on ipad at the same time I tried the following code, but it does not play multiple audio

<audio id="audioId" src="music.mp3">Play audio</audio>
<audio id="audioId1" src="intro.mp3">Play audio</audio>
 <script>
  document.getElementById("audioId").play();
  document.getElementById("audioId1").play();
 </script>

The above code does not play both audio files in iPad

+4
source share
1 answer

It takes a click or touch to play sound on the touch device; you can play multiple audio on the device using the following code

  <div id="btn">Play Double sound</div>
  <script type="text/javascript">
         $(document).ready(function(){

                $("#btn").on("click",function(){
                        alert("audio clicked");
                        var aud=new Audio();
                        aud.src="music.mp3";
                        aud.play();
                        var aud1=new Audio();
                        aud1.src="intro.mp3";
                        aud1.play();
                    })
        });

    </script>

The above code plays multiple audio on touch devices

+3
source

All Articles