javascripthtmlaudio

HTML5 check if audio is playing?


What's the javascript api for checking if an html5 audio element is currently playing?


Solution

  • function isPlaying(audioEl) {
      return !audioEl.paused;
    }
    

    The Audio tag has a paused property. If it is not paused, then it's playing.