Reputation: 511
I have a NetGroup established using Adobe Cirrus. All clients can connect fine and see each other, since I receive NetGroup.Neighbor.Connect
and NetGroup.MulticastStream.PublishNotify
events when a new stream is being published.
However, if a user subscribes to a published stream, the publisher does not receive a notification (no NetStatusEvent and no callback to the onPeerConnect method). The subscriber receives the stream without problems, though.
All other questions about the non working onPeerConnect method were related to NetStream.DIRECT_CONNECTIONS, but in my case, I am using a NetGroup.
What is wrong here?
// Only the relevant parts, a few things have been stripped (e.g. connect the netGroup only when the NetConnection has been established etc.)
var groupSpecifier:GroupSpecifier = new GroupSpecifier("group");
groupSpecifier.multicastEnabled = true;
groupSpecifier.postingEnabled = true;
groupSpecifier.serverChannelEnabled = true;
groupSpecifier.objectReplicationEnabled = true;
groupSpecifier.ipMulticastMemberUpdatesEnabled = true;
groupSpecifier.routingEnabled = true;
var netGroup:NetGroup = new NetGroup(netConnection, groupSpecifier.groupspecWithAuthorizations());
var netStream:NetStream = new NetStream(netConnection, groupSpecifier.groupspecWithAuthorizations());
netStream.client = {onPeerConnect:onPeerConnect};
netStream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
// Never gets called
public function onPeerConnect(netStream:NetStream):Boolean {
trace("onPeerConnect: "+netStream.farID);
return true;
}
private function onNetStatus(event:NetStatusEvent):void {
trace(event.info.code);
switch(event.info.code) {
case EventCodes.STREAM_CONNECT_SUCCESS :
netStream.attachCamera(camera);
netStream.attachAudio(microphone);
netStream.publish(streamName);
break;
}
}
Upvotes: 0
Views: 806
Reputation: 511
onPeerConnect is only being called when using DIRECT_CONNECTIONS, not for NetGroups. Unfortunately, this is not mentioned in the documentation or anywhere else.
Upvotes: 3