Home jquery play stop audio file
Reply: 0

jquery play stop audio file

user511
1#
user511 Published in June 20, 2018, 12:03 am

I have a list of songs and the way im using to access them is :

<a href="path to song 1">play</a>
<a href="path to song 2">play</a>
...

when the link is clicked, the song starts and im doing this with jquery like this:

$('a').on('click', function() {
    var path = $(this).attr('href');
    var song = new Audio(path);
    song.play();
});

How can i make a play/stop toggle when the link is clicked?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317526 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO