2011-01-29 3 views
2
나는 새로운 RTMFP 프로토콜을 사용하는 플렉스에서 피어 - 투 - 피어 화상 회의 응용 프로그램을 구현하고있어

..스트림의 이름 (RTMFP 넷 문제, 플렉스/AS3)를 얻는 방법

그룹의 이름이 Group1이라고 가정 해 봅니다. 내가 원하는 것은; 새로운 피어가 Group1에 연결되면; 참여하는 각 피어에 대해 새로운 비디오 디스플레이를 만들고 즉시 자신의 스트림을 재생하십시오.

나는 NetConnection"NetStream.Connect.Success"NetStatus 이벤트를 듣습니다. 새 피어를 추가하고 스트림을 재생하고 싶습니다.

는하지만 내 문제는 :

어떻게 내가 그 참여 피어 그 스트림을 재생할 수있는 스트림의 이름을 알 수 있습니다. 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; 
    } 
} 

이 어떤 도움 .. 감사 감사한다

답변

1

streamIn = new NetStream(conn, NetStream(e.info.stream).farID

//... 
streamIn.receiveVideo(true); 
streamIn.receiveAudio(true); 
streamIn.play(/*here you need to use the string you pass to NetStream.publish() on the other side*/); 
+0

물론 나는 게시 된 문자열이 필요합니다. 질문은 어떻게 스트림 이름을 얻습니까? 나는 물었다. .. –

+0

@ radgar - 너는 어떻게 그것을 사용할거야? – www0z0k

+0

@ radgar - NetStream에 name 속성이 없다는 것을 의미합니다. 게시/재생할 때 문자열 ID를 사용하고 rtmfp/rtmpe가 넘으면 farID/nearNonce가 있습니다. – www0z0k

2
 case "NetGroup.MulticastStream.PublishNotify": 
      trace(event.info.name) 
      break; 

    case "NetGroup.MulticastStream.UnpublishNotify": 
     trace(event.info.name) 
     break; 
당신은 스트림 이름을 얻을 수 있습니다

: 여기

코드의 짧은 버전입니다 위의 코드에서 ..... 당신은 어떤 이름으로 스트림을 publsh하고 그 이름이 여기에 나타날 때, 나는 생각한다 NetStream.Connect.Success 다음이 정보도 확실하지 않은 것처럼 보입니다 ...... 건배