Skip to main content
Participant
August 29, 2015
Answered

SoundChannel SOUND_COMPLETE not being fired when SoundChannel.stop() called...

  • August 29, 2015
  • 1 reply
  • 454 views

Hi all...

I'm writing some code that's an audio player; I'm using the streaming API (the SAMPLE_DATA event) to push the audio data.

This works fine, and I get a SOUND_COMPLETE event when there is no more sound data.

However, if I execute the function SoundChannel.stop() (in response to a "pause" button being pressed onscreen), the audio stops, but no SOUND_COMPLETE event is generated.

Is this as expected?  It seems odd to me that a SOUND_COMPLETE event would only be generated when incoming sound data is exhausted, but not when the stop() method is called.

Does anyone have experience with these APs?  I couldn't find a solution anywhere I've searched so far...

- Tim

This topic has been closed for replies.
Correct answer kglad

actually, i don't see a satisfactory way to do that because the soundchannel class is final and therefore cannot be extended (without hacking the soundchannel class).

imo, tracking that in the obvious way is preferable.  ie, you know when stop() is applied, do or call whatever when that occurs.

1 reply

kglad
Community Expert
Community Expert
August 29, 2015

it's a soundcomplete event, not a soundstopped event so it makes sense to me.

and it you want to create a custom soundstopped event that dispatched when a sound stops, create it.

tbessieAuthor
Participant
August 29, 2015

Thanks, kglad - so, there's a way in ActionScript to add custom events to custom actions in predefined components like SoundChannel?

I could surely add my own event when I call SoundChannel.stop(), but that would be without knowledge of what SoundChannel.stop() is doing internally; ideally I'd generate such an event when stop() closes an actively playing stream (one that isn't already stopped), so that would require modifying the internals of SoundChannel, wouldn't it?

- Tim

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 30, 2015

actually, i don't see a satisfactory way to do that because the soundchannel class is final and therefore cannot be extended (without hacking the soundchannel class).

imo, tracking that in the obvious way is preferable.  ie, you know when stop() is applied, do or call whatever when that occurs.