在哪里可以找到基于AS3和Red5的视频聊天应用程序的工作示例? 我无法理解如何将用户流附加到另一个用户,反之亦然。有人可以指向一个简单的示例或提供者一些示例代码吗?
答案 0 :(得分:1)
以下是Red5的SimpleChat演示项目的链接:http://www.red5.org/downloads/simpledemos/
无论如何只是为了给你一个基本概念: 假设您有一个聊天应用程序,每个用户都有一个ID,对吧?因此,假设用户 A 开始将mic / cam流式传输给用户 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');