R – Flex: computeSpectrum with streaming media

apache-flexflashred5spectrumstreaming

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?

Best Answer

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>