views:

23

answers:

1

We have a flash app streaming live video to our clients which may or may not have available. When audio is available, we are showing controls to mute or alter the audio volume. When audio is not available, we hide those controls. These are necessarily different streams, but could be the same stream where the broadcaster has disbaled their microphone at some point. So the client may have detected audio initially had displayed controls, but once the broadcaster disabled their mic, the client on the receiving end recognizes no more audio is transmitting and hides the controls.

We were doing this in Flex 4, targetting flash 10, by using the netSream.info.audioBytesPerSecond property on the receiving client to see if any audio was being sent down. However we've been informed by the powers that be that we need to target flash 9 in which this property is not available.

So, in short, is there a way in Flex 3.5, targetting flash 9, to determine if a live stream has audio available? Note, we tried metaData as well for the initial indication of audio, but we need to be able to check on a timer periodically as the broadcaster may turn off their mic and thus disable audio mid stream.

+1  A: 

What about using SoundMixer.computeSpectrum() and check the value of the ByteArray associated with it with an enterFrame event? As soon as the ByteArray is filled with values other than zero , audio is being detected

PatrickS
Thanks for the suggestion, Partick. We're kind of new with AS3 and flash programming in general, so we looked over the most obvious solution to tackle what wanted. Namely, to just call netStream.send with a custom method from the broadcaster side to the tell the clients we are or aren't sending audio so they can enable or disable their audio controls. We were just trying to "detect audio" because we didn't realize you could send custom commands like this (again, we're really new at this). Since this is sufficient, we really don't have a need to actually listen in anymore for audio bytes.
WesleyJohnson
But I'm up-voting you for a good response. :)
WesleyJohnson