The AudioPublisher and AudioSubscriber components are the principal ways to add audio communication (also known as Voice over IP, or VoIP) to a collaborative application. As they're meant to fit within highly customized workflows, these components are completely "headless" - that is, they don't have any user interface whatsoever, and the desired UI is to be built by the developer of the application.
However, hooking the APIs of these components up to a UI couldn't be much easier - publishing audio is a simple matter of instantiating an audioPublisher and calling audioPublisher.publish(); In the Flash Player, this will cause the publishing user to see the following :
Stream prompt dialog
Upon accepting this dialog, the user in question will have audio captured from their computer microphone and broadcast to any subscribers listening.
It is highly recommended that your users use microphone-and-speaker headsets when publishing and subscribing to VoIP streams - this will greatly reduce echo and improve audio quality.
The audioPublisher also provides a variety of APIs for controlling the broadcast settings of the audio - microphone gain, silence level and timeOut.
In order to receive audio, simply instantiate an audioSubscriber, which will receive any audio streams and play them through the computer speakers. This component is also "headless", with any UI workflow to be designed and coded by the developer. The subscriber also provides APIs for setting the local volume of the various streams it is receiving.
A word about codecs
A "codec" is a library used to encode audio from the microphone for sending over a stream, and for decoding that audio stream for playing through the computer's speakers. The Flash Player provides 2 codecs :
- Player 6 to Player 9 : The NellyMoser codec is used.
- Player 10.0 and above : The Speex coded is used.
It is advisable that if you can deploy your application to use Player 10 or higher, the Speex codec is automatically the default choice for LCCS, which presents a noticeable improvement in audio quality for VoIP conversations (Speex is a codec especially tuned to the frequency domain of the human voice, and is more tolerant of packet loss than NellyMoser).