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

SoundMixer.computeSpectrum broken + weird issues with timers/callbacks

New Here ,
Mar 06, 2015 Mar 06, 2015

Hey,

We have code for an RTMP streaming audio player (which uses SoundMixer.computeSpectrum) which has been working fine for about a year now, but recently stopped working. Just looking for advice and pointers. We originally thought that this was an issue relating to Flash 16 but seems we do see this problem on Flash 15 and 14 too (slowly working my way back through the versions...)

It isn't an issue on the Flash version available for Ubuntu (Flash v11) as it works fine on our development machines (hence not noticing this issue in production)

Snippets here:

// This gets called on Event.ENTER_FRAME:

SoundMixer.computeSpectrum(wave_form_data, false, 2);

...

private function wave_data ():void {
  var list = [];
  for (var i:int = 0, j:int = wave_form_data.length / 4; i < j; i++) {
    list.push(int(wave_form_data.readFloat() * 512));
  }
  js_callback('wave_data', list.slice(0, 256).join(','), list.slice(256).join(','));
}

This method is called several times per second via a timer:

this.wave_timer = setInterval(wave_data, 100);

And cleared when the stream is stopped:

clearInterval(wave_timer);

But we have started to see two issues:

1) The wave_data JS callback comes through to the browser intermittently (seems a bit sporadic - occasionally we get 3 or 4 events through at once when the stream starts, or sometimes just one, or at one point I got nothing until a few seconds after stopping the stream then got 50 of them through at once.

2) the waveform data (which come from readFloat() ) is always filled with zeroes regardless of the audio playing at any given time.

As mentioned the same code works in previous versions of Flash.

Would be grateful for any advice here.

Thanks.

TOPICS
ActionScript
165
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
no replies

Have something to add?

Join the conversation