jeudi 22 janvier 2015

Audio jQuery play on click

I want to make an audio player like this: beyonce.com/track. I tried to do this with [ion.Sound plugin] - http://ift.tt/1aoVrR8


For design part, more extactly to change icon from PLAY in PAUSE I've used



$(function(){
var button = $('button.player');

$(button).on('click', function(e) {
$('span.play').toggleClass("none"); //
$('span.pause').toggleClass("block");
e.preventDefault();
});


ion.sound({
sounds: [
{name: "beer_can_opening"},
{name: "bell_ring"}
],
path: "sounds/",
preload: true,
volume: 1.0
});

$(button).on("click", function(){
ion.sound.play("beer_can_opening");
});
});


The design part with change of icon works fine, except the time, on beyonce website the icon it's changing when the audio file ends.


I think this it's not the best concept.. i was thinking to do something with attr.. can any give me some ideas?


Aucun commentaire:

Enregistrer un commentaire