我们正在运行Cumulus服务器来进行实时语音和文本聊天。NetStream.send在RTMFP中与NetGroup不能配合使用
设置是每个客户端可以通过group.post()将数据发布到同一个NetGroup中的每个其他客户端。不幸的是,该函数非常慢(至少半秒延迟),所以我们转而使用NetStream.send在其他客户端上调用函数,并通过该函数传递数据。这几乎立即运作。
但是,我们现在尝试使用不同的NetGroups建立单独的聊天室。但是,当这样做时,NetStream.send()不再工作,这些功能从不会在其他客户端上调用,也不会传输语音数据。基本上,整个发布NetStream似乎不再工作。
我们有如下的设置来建立与NetGroup和每个客户端上发布流:
var gspec:GroupSpecifier = new GroupSpecifier("Group1");
gspec.multicastEnabled = true;
gspec.postingEnabled = true;
gspec.serverChannelEnabled = true;
gspec.objectReplicationEnabled = true;
gspec.routingEnabled = true;
_group = new NetGroup(_netConnection, gspec.groupspecWithAuthorizations());
_group.addEventListener(NetStatusEvent.NET_STATUS, handleNetGroupStatus);
_sendStream = new NetStream(_netConnection, gspec.groupspecWithAuthorizations());
_sendStream.addEventListener(NetStatusEvent.NET_STATUS, handleNetStreamStatus);
_sendStream.client = this;
_sendStream.attachAudio(_mic);
_sendStream.publish("media");
而下面的代码是用来听的“媒体”流:
case "NetGroup.Neighbor.Connect":
var netStream :NetStream = new NetStream(_netConnection, p_netStatusEvent.info.peerID);
netStream.addEventListener(NetStatusEvent.NET_STATUS, handleNetStreamStatus);
netStream.client = this;
netStream.play("media");
break;
NetGroup连接本身起作用,当邻居连接时,每个客户端都会调用“NetGroup.Neighbor.Connect”。但是_sendStream本身根本行不通。没有收到数据,没有函数调用。
它确实当发布方NetStream以下列方式构建的工作:根据
_sendStream = new NetStream(_netConnection, NetStream.DIRECT_CONNECTIONS);
然而,我们只希望将NetStream发送到一个单一的网络组和到Adobe Documentation,使用gspec.groupspecWithAuthorizations ()在构造函数中应该完全允许。
我们在这里错过了什么吗?