Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Aug 29, 2015 Aug 29, 2015

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

TOPICS
ActionScript
406
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 30, 2015 Aug 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.

Translate
Community Expert ,
Aug 29, 2015 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 29, 2015 Aug 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 30, 2015 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 01, 2015 Sep 01, 2015

Yep, that's what I ended up doing - doing whatever I'd do at a SOUND_COMPLETE after I've manually called .stop().

Thanks for your suggestion, it helped. 🙂

- Tim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 01, 2015 Sep 01, 2015
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines