onemaxone

Managing in app audio

Recommended Posts

Hi I have built an app in Phaser and want to create a sequence of two sounds:

1. "You have" (loaded and stored as audioSound[0])
2. "Finished" (ditto, audioSound[1])

I can then keep re-using 1 and have different words/sentences in 2. To do this I need the sounds to play in sequence.

At the moment using:

    audioSound[0].play();

    audioSound[1].play();

    othercode...


Plays both at the same time. Any ideas on how to get the sounds to play in sequence and only continue to `othercode...` once the second one has finished?

Thanks in advance!

Share this post


Link to post
Share on other sites

You should be able to use the onStop signal

audioSound[0]

  .play()

  .onStop.add(audioSound[1].play, this);

othercode...

If you're going to reuse the first sound for other things then you can consider adding a property to it that will indicate which sound will be played next so you can just change that property instead of having to remove and re-add new onStop events to your first sound.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.