Wednesday, 12 March 2014

How to play sound or mp3 using Jquery, Javascript in HTML5


<!--@*Script to be added in html page :*@-->

 <script language="javascript" type="text/javascript">
     try {
         var bleep = new Audio();
         bleep.src = 'TimerBeep.mp3';
     }
     catch (er) {
     }
     function playBeepSound() {
         bleep.play();
     }
 </script>

 <!--Add Call to function playBeepSound() in html using JavaScript events-->

 <input id="btnPlaySound" onclick="playBeepSound();" />

 <!--Add TimerBeep.mp3 media file in same folder where html file is present-->


No comments:

Post a Comment