1

Where can I find working examples of a video chat application based on AS3 and Red5? I'm having trouble to understand how to attach a user stream to another user and vice-versa. Can someone point to a simple example or provider some sample code?

4

1 回答 1

1

这是 Red5 的 SimpleChat 演示项目的链接:http ://www.red5.org/downloads/simpledemos/

无论如何只是给您一个基本概念:假设您有一个聊天应用程序,您将为每个用户拥有一个 ID,对吗?因此,让我们假设用户A开始将麦克风/摄像头流式传输给用户B的场景:

//start streaming the mic and camera
nsPub = new NetStream ( netConnection );
nsPub.attachAudio(Microphone.getMicrophone());
nsPub.attachCamera(Camera.getCamera());
nsPub.publish('A');

//need to send a command to user B to notify him that user A started streaming, 
//this command can be sent by a SharedObject or invoking a remote method, that will 
//invoke a client method in B

//code to receive the mic/cam streaming from user A
nsCli = new NetStream ( netConnection );
videoCompoment.attachNetStream( nsCli );
nsCli.play('A');
于 2013-05-15T23:48:39.183 回答