Robot Not a Dev? Buy Now
Not a Dev?

Misty Community Forum

Make playAudio API return signal upon the audio completes playing

Hi,

I wonder if the playAudio could return signal only upon the time when the audio actually finished playing.

The is important so when developing we can queue up audios to play.

Hi @fishbb,

Misty triggers an AudioPlayComplete event type when an audio file finishes playing. You can register for this event type in your skill code to trigger a callback function. Using the JS SDK, that might look like this:

misty.PlayAudio("FirstFile.Wav")
misty.RegisterEvent("DonePlaying", "AudioPlayComplete", 100, false);

function _DonePlaying() {
	misty.PlayAudio("NextFile.wav");
};

You can use this pattern to queue up different audio files.

Hope that gets you a bit closer to a solution. If you have a specific change you’d like to suggest to the functionality of a command in Misty’s API, please make a note of it in the Wishlist category!

2 Likes

You can even just change the category of this post :slight_smile:

@johnathan Good to know there is already an event!