Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If on click loop true #66

Open
klepso opened this issue Jan 3, 2016 · 25 comments
Open

If on click loop true #66

klepso opened this issue Jan 3, 2016 · 25 comments
Assignees
Labels

Comments

@klepso
Copy link

klepso commented Jan 3, 2016

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 ?

@IonDen
Copy link
Owner

IonDen commented Jan 4, 2016

Hello, you should name sound you want to play and loop. Like this:
ion.sound.play("name", {loop: true});

@IonDen IonDen added the Question label Jan 4, 2016
@IonDen IonDen self-assigned this Jan 4, 2016
@klepso
Copy link
Author

klepso commented Jan 4, 2016

Actually i want make this effect to all songs how should i do that ?.

@klepso
Copy link
Author

klepso commented Jan 4, 2016

What about i give a alias to all sounds and i called by the code above ? should work right ?

@IonDen
Copy link
Owner

IonDen commented Jan 5, 2016

You can try to call play without name. It should play all sounds with given config.

@klepso
Copy link
Author

klepso commented Jan 5, 2016

How should i give a config ?

@IonDen
Copy link
Owner

IonDen commented Jan 6, 2016

Try like this: ion.sound.play({...}); without name. It should play all.

@klepso
Copy link
Author

klepso commented Jan 6, 2016

Where is the loop:true ?

@klepso
Copy link
Author

klepso commented Jan 6, 2016

This the loop true it's a option for the user, this what i want

@IonDen
Copy link
Owner

IonDen commented Jan 6, 2016

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.

@klepso
Copy link
Author

klepso commented Jan 6, 2016

I haved add this code
ion.sound.play({loop:true});
But this does not made any change.

@klepso
Copy link
Author

klepso commented Jan 6, 2016

What about
else
Loop:false ?

@IonDen
Copy link
Owner

IonDen commented Jan 6, 2016

Please describe app logic one more time

@klepso
Copy link
Author

klepso commented Jan 6, 2016

It's a Drumpad
Like drumpad24 on ios
But my own is on web.

@IonDen
Copy link
Owner

IonDen commented Jan 6, 2016

More information about logic. What are the buttons what they should do?

@klepso
Copy link
Author

klepso commented Jan 6, 2016

I made 2 button one for looping all time and one for looping 2 time

@IonDen
Copy link
Owner

IonDen commented Jan 6, 2016

And what does this buttons do? Set loop to true and play some sound?

@klepso
Copy link
Author

klepso commented Jan 6, 2016

Exact.
Demo link : http://kl3ps0.esy.es/projects/drumpad/v2/index.html

@IonDen
Copy link
Owner

IonDen commented Jan 6, 2016

// 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

@klepso
Copy link
Author

klepso commented Jan 6, 2016

Should i adding it by onclick in the html button ?

@IonDen
Copy link
Owner

IonDen commented Jan 6, 2016

Yes, i think all other code you should write by yourself)

@klepso
Copy link
Author

klepso commented Jan 6, 2016

Ok i will try

@klepso
Copy link
Author

klepso commented Jan 6, 2016

capture
It's not working!

@IonDen
Copy link
Owner

IonDen commented Jan 7, 2016

Hi, please provide simplified online demo. I will check.

@klepso
Copy link
Author

klepso commented Jan 7, 2016

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.

@IonDen
Copy link
Owner

IonDen commented Jan 8, 2016

I will check this on weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants