pareshm
pareshm

Reputation: 4984

Play multiple audios on Ipad or touch devices

How to play multiple audio on ipad at same time i have tried following code but it doe not plays 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 audios on IPAD

Upvotes: 4

Views: 574

Answers (1)

pareshm
pareshm

Reputation: 4984

You require click or touch to play audio on touch device you can play multiple audios on device using 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 audios on touch devices

Upvotes: 3

Related Questions