actionscript-3video-streamingred5

simple video chat using as3


I'm trying to make a simple video chat using Flex framework and red5 server. It's an application with 2 video displays. With connection to the server more or less figured out. However, I do not understand how to transfer user1 stream to user2. Here is functions i use to transfer webcam image to the server and to get the stream.

public function appendStream(connection:NetConnection):void {
            myNetStream = new NetStream (connection);
            myNetStream.attachAudio(cameraVideo.getMic());
            myNetStream.attachCamera(cameraVideo.getCam());
            myNetStream.publish("videochat" , "live");          
        }

public function getStream(connection:NetConnection):Video {
            guestNetStream = new NetStream(connection);
            video2.attachNetStream (guestNetStream);
            guestNetStream.play("videochat");
            return video2;
        }

As you can see, i am getting my own stream.

Is it possible to solve the problem by flex, or I need programming on the server side?


Solution

  • You dont need separate rooms, simply use unique stream names for each client. The ez way is to create your steam names ahead of time and pass them to your swf via flashvars; that way you dont have to pair them with some other complicated scheme.
    For a bit more background in red5, a room is a type of scope and a scope can contain other scopes which includes broadcast scopes, shared object scopes, and rooms. There is no limit on the number of these scopes other than the amount of RAM on the server itself.