Friday, February 1, 2013

Stop playback in HTML5 audio using Javascript


Stop playback in HTML5 audio using Javascript


You may wanted to stop playback of an audio playing via audio HTML5 tag.
Here is the code :
document.getElementById('audio').currentTime = 0;//By ID
document.getElementsByTagName('audio').currentTime = 0;//By Tag
It's that simple. Just use currentTime = 0.

No comments:

Post a Comment

Leave the comments