How can we loop the same audio file in soundamanager2?
This is my sample code
function playSound(url) {
soundManager.setup({
url: 'swf',
onready: function() {
soundManager.createSound({
id: 'samplesound',
url: url,
volume: 100
});
soundManager.play('samplesound');
}
});
}
I am calling it from a tag like
<a href='javascrit:void(0);' onclick='playSound('url');'></a>
How can I loop this sound continuously for respective times?
You can loop the sound using the play command
The following should play the sound 3 times
soundManager.play('samplesound',{loops: 3});
a hack to get the loops working could be
var loops = 3;
var looped = 0;
soundManager.createSound({
id: 'samplesound',
url: url,
volume: 100,
onfinish:function() {
if(looped<loops){
soundManager.play('samplesound');
looped++;
} else{
looped = 0;
}
)}
});
see
http://www.schillmania.com/projects/soundmanager2/demo/api/
and
http://www.schillmania.com/projects/soundmanager2/doc/#smsoundmethods