12 November 2008

Flex Video Chat

Categories:   Flash Media Server Flex

So just this past week, I hosted a party for some former classmates of mine, and thought it would be great if classmates who could not attend the event in person have a way to still be part of the party and interact with those who did attend.  The obvious thought was to have a chat application, but wanted to take it a step further and add a live video stream, and integrate the two together.  I found a simple Flex chat application that was put together by Stefan Richter which used Flash Media Server as the central connecting point, and to add the live video stream I just integrated my live weather widget application posted earlier which is basically an FMS live video stream.

 Some of the issues that came up was the incredible lag time between the live broadcast stream and when the end users received it.  The lag got progressively worse the longer the steam played.  After some research it was discovered that an apparent bug cases this and the workaround is to specifically set the microphone bitrate to 22Khz: 

microphone = Microphone.getMicrophone();
microphone.rate = 22;
 

For simplicity, I created two separate applications in the Flex project.  One for the end users, and one for the broadcaster.  Both are very similar, but each uses it's own unique Video Pod component.  One plays the video, and the other publishes it.
 
Check out the source code here.

-Christopher Keeler