Detecting if audio is already playing

I’ve been bouncing around the forums and docs but can’t find how to detect if an audio object is currently playing or not.  Any ideas?

Thanks

I don’t think you can detect if a specific audio object is being played, but you definitely can detect if a channel is being played using audio.isChannelPlaying() (http://docs.coronalabs.com/api/library/audio/isChannelPlaying.html).

If you wanted to know whether a particular audio object is being played, what you could do is store the channel information every time you play it.  Once you do that, then if you want to know whether that particular audio object is being played, you could check whether the channel or channels it was assigned are playing.

  • Andrew

Thanks, I need to do a little reading up on audio channels.

I don’t think you can detect if a specific audio object is being played, but you definitely can detect if a channel is being played using audio.isChannelPlaying() (http://docs.coronalabs.com/api/library/audio/isChannelPlaying.html).

If you wanted to know whether a particular audio object is being played, what you could do is store the channel information every time you play it.  Once you do that, then if you want to know whether that particular audio object is being played, you could check whether the channel or channels it was assigned are playing.

  • Andrew

Thanks, I need to do a little reading up on audio channels.