Jump to content

Managing in app audio


onemaxone
 Share

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!

Link to comment
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.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...