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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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