views:

379

answers:

4

I have a Flex3 app I wrote and I'm streaming audio over RTMP from a Red5 server. I'd love to be able to use SoundMixer.computeSpectrum(), but the spectrum data is all zeros. In one location, Adobe writes that SoundMixer.computeSpectrum() does not work with RTMP data:

"For media loaded from RTMP sources, you cannot use the BitmapData.draw() and SoundMixer.computeSpectrum() methods to extract run-time graphics and sound data." http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000353.html

Clear enough. Except, there's the actual documentation for computeSpectrum():

"In addition, this method cannot be used to extract data from RTMP streams, even when it is called by content that reside in the same domain as the RTMP server. [...] This method is supported over RTMP in Flash Player 9.0.115.0 and later and in Adobe AIR."

Ummm. That seems contradictory to me.

Any advice one way or the other?

A: 

computeSpectrum and ID3 tags doesnt work with data from other domain than where flex application is located.

Laserson
So... you're saying computeSpectrum ~should~ work with RTPM if the flex app comes from the same server as the RTMP server?
organicveggie
I've found one example for you that shows how to use computeSpectrum with RTMP servers (i didnt read it) - http://www.wowzamedia.com/forums/showthread.php?p=13367 . Maybe it will help you
Laserson
It has nothing to do with domain(s) "other than where flex application is loaded."
amn
A: 

Quoting Adobes own public document "Programming Adobe ActionScript 3.0 for Flash", page 700 (chapter 32, heading "Loading content", sub-heading "Content delivered using RTMP servers":

For media loaded from RTMP sources, you cannot use the BitmapData.draw() and SoundMixer.computeSpectrum() methods to extract run-time graphics and sound data.

The good old RTFM (Read The Friendly Manual) piece of advice still applies.

amn
With all due respect, I did RTFM. I quoted the exact same blurb you did in my original question. However, as I mentioned in my question, the Adobe documentation for SoundMixer.computeSpectrum() itself says both that it doesn't support RTMP and that it does support RTMP.http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundMixer.html#computeSpectrum%28%29
organicveggie
I don't see how the two contradict each other - both say you cannot compute spectrums for RTMP media. As to RTFM, yes, I jumped ahead of myself, and I do apologize.
amn
Based on my own experiments, I'm inclined to agree that you cannot use computeSpectrum() with RTMP media. Despite that, the documentation for computeSpectrum() (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundMixer.html#computeSpectrum%28%29) says, "This method is supported over RTMP in Flash Player 9.0.115.0 and later and in Adobe AIR."
organicveggie
A: 

There is also the 'client.allowAudioSampleAccess' property on server-side (Flash Media Server scripts), which allows clients to, as far as I understood, do exactly what you want - read audio sample data by the 'computeSpectrum' method.

amn
Red5 (which he references) doesn't support this field, so this really doesn't apply here.
Mondain
A: 

Here is an overall blog post on the subject: http://fefranca.com/blog/?p=6 And here is a proposed fix for Red5: http://osflash.org/pipermail/red5_osflash.org/2009-November/038844.html

<bean id="rtmpSampleAccess" class="org.red5.server.stream.RtmpSampleAccess">
    <property name="audioAllowed" value="true"/>
    <property name="videoAllowed" value="true"/>
</bean>
Mondain