If on click loop true
klepso opened this issue · comments
Hey, i've made a drumpad site, now i made a button with id looping, i want when the user clicking on the sound button "Onclick only" the sound looping for infinity
this my javascript code :
$(document).ready(function(){
$("#looping").on("click", function(){
ion.sound({loop: true});
});
HTML : <button type="button" id="looping">►Looping</button>
How can i make this work ?
Hello, you should name sound you want to play and loop. Like this:
ion.sound.play("name", {loop: true});
Actually i want make this effect to all songs how should i do that ?.
What about i give a alias to all sounds and i called by the code above ? should work right ?
You can try to call play without name. It should play all sounds with given config.
How should i give a config ?
Try like this: ion.sound.play({...}); without name. It should play all.
Where is the loop:true ?
This the loop true it's a option for the user, this what i want
ion.sound.play("name", {loop: true}); // play exact sound with loop enabled
ion.sound.play({loop: true}); // play all sounds with loop enabled
You may also preset loop to true at start by passing it to general config.
Or maybe i still cant understand you question.
I haved add this code
ion.sound.play({loop:true});
But this does not made any change.
What about
else
Loop:false ?
Please describe app logic one more time
It's a Drumpad
Like drumpad24 on ios
But my own is on web.
More information about logic. What are the buttons what they should do?
I made 2 button one for looping all time and one for looping 2 time
And what does this buttons do? Set loop to true and play some sound?
Exact.
Demo link : http://kl3ps0.esy.es/projects/drumpad/v2/index.html
// General config
ion.sound({
sounds: [
{
name: "bass_sample"
}
],
volume: 1,
path: "sounds/",
preload: true
});
ion.sound.play("bass_sample", {loop: true}); // on button 1
ion.sound.play("bass_sample", {loop: 2}); // on button 2
Should i adding it by onclick in the html button ?
Yes, i think all other code you should write by yourself)
Ok i will try
Hi, please provide simplified online demo. I will check.
http://Kl3ps0.esy.es/projects/drumpad/v2/
There problem with idm on chrome
But work on Firefox
ONLY QWER is work for this time it's just a demo.
I will check this on weekend.