Create Audio and set HTML5 Audio Looping - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Audio

Description

Create Audio and set HTML5 Audio Looping

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
var audio = new Audio("http://example.com/your file.mp3");
audio.addEventListener('canplaythrough', function() {
  this.currentTime = this.duration - 10;
  this.loop = true;//from  ww  w.ja v  a 2 s .c o m
  this.play();
});

      </script>  
   </body>
</html>

Related Tutorials