开发者

Flex: computeSpectrum with streaming media?

开发者 https://www.devze.com 2022-12-16 15:48 出处:网络
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 w

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 doc开发者_开发百科umentation 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?


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>


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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消