我正在使用新的RTMFP协议和NetGroups在 Flex 中实现对等视频会议应用程序。
假设组的名称是 Group1。我想做的是;当一个新的对等点连接到 Group1 时;为每个加入的同伴创建一个新的视频显示并立即播放他/她的流。
我听on的NetStatus
事件;我想添加新的同伴并播放他/她的流。NetConnection
"NetStream.Connect.Success"
但我的问题是:
我如何知道流的名称,以便我可以为加入的对等方播放该流。NetStream.Connect.Success
只会给我event.info.stream
财产,但我找不到要为该特定对等方播放的流的名称。
这是代码的简短版本:
private function connect():void
{
var conn:NetConnection = new NetConnection();
conn.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
conn.connect(rtmfpServer);
}
private function setupGroup():void
{
var gspec:GroupSpecifier = new GroupSpecifier("Group1");
gspec.multicastEnabled = true;
gspec.postingEnabled = true;
gspec.serverChannelEnabled = true;
var group:NetGroup = new NetGroup(conn, gspec.groupspecWithAuthorizations());
group.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
}
protected function onNetStatus(e:NetStatusEvent):void
{
switch (e.info.code)
{
case "NetConnection.Connect.Success": //connected to the server
setupGroup(); //create and connect to the group
break;
case "NetGroup.Connect.Success": //connected to the group
publishMyVideo(); //create a player for my own video and publish it to the group
break;
case "NetStream.Connect.Success": //a new stream is connected
if (NetStream(e.info.stream) != myStream) //if this is not my own stream; it's a new joining peer...
{
createPlayerForPeer(); //Create a video player for each joning peer
playPeersVideo(); //what is the stream name to play?
}
break;
}
}
任何帮助表示赞赏..谢谢..