check if audio element is playing css

54

var myAudio = document.getElementById('myAudioID');

if (myAudio.duration > 0 && !myAudio.paused) {

    //Its playing...do your job

} else {

    //Not playing...maybe paused, stopped or never played.

}

Comments

Submit
0 Comments