新しいRTMFPプロトコルとNetGroupsを使用して、Flex でピアツーピア ビデオ会議アプリケーションを実装しています。
グループの名前が Group1 だとしましょう。私がやりたいことは次のとおりです。新しいピアが Group1 に接続するとき。参加するピアごとに新しいビデオ ディスプレイを作成し、そのストリームをすぐに再生します。
and 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;
}
}
どんな助けでも大歓迎です..ありがとう..