Search code examples
javascripthtmlmp3html5-audio

Is there a way to mark audio file


If I have a mp3 audio file (imported on my website), is there a way to mark it. I mean that whenever I hit pause, I want to mark that time in the audio file and store that it in an array. Is this possible?

Thank you


Solution

  • Try the following:

    var vid = document.getElementById("myVideo");
    
    vid.onpause = function() {
    
      alert(this.currentTime);
    
    };
    

    Save this.currentTime wherever you would like to.

    Hope this Helps

    Just for Reference, have a look at HTML5 Video events in action:

    http://www.w3.org/2010/05/video/mediaevents.html