Skip to content

Instantly share code, notes, and snippets.

@tushar-borole
Created March 13, 2017 16:59
Show Gist options
  • Save tushar-borole/06dd040fbb9df6810509ec72626779ed to your computer and use it in GitHub Desktop.
Save tushar-borole/06dd040fbb9df6810509ec72626779ed to your computer and use it in GitHub Desktop.
Auto Play audio on the page
var audioArray=$( "audio" )
audioArray.each(function( index ,value) {
value.onended = function() {
if(audioArray[index+1]){
audioArray[index+1].play()
}else{
audioArray[0].play()
}
};
value.onplay = function() {
console.log("The video has started to play",index);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment