Adobe Cirrusを使用してNetGroupを確立しました。新しいストリームの公開時には、NetGroup.Neighbor.Connect
イベントとNetGroup.MulticastStream.PublishNotify
イベントが受信されるため、すべてのクライアントを正常に接続してお互いに見ることができます。Adobe Cirrusを使用したonPeerConnectメソッドが起動しない
ただし、ユーザーがパブリッシュされたストリームにサブスクライブすると、パブリッシャーは通知を受け取りません(NetStatusEventなし、onPeerConnectメソッドへのコールバックなし)。しかし、加入者は問題なくストリームを受信します。
onPeerConnectメソッドが動作していないことに関する他の質問はすべてNetStream.DIRECT_CONNECTIONSに関連していましたが、私の場合はNetGroupを使用しています。
ここで何が間違っていますか?
// 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;
}
}