2014-11-24 57 views
0

以下是多播P2P視頻使用Adobe捲雲流的接收器部分。接收在網絡組的p2p多播多個流入流束(土坯捲雲)

我想從多個廣播接收流,併發揮其作爲獨立的視頻流,在多播我怎麼可以循環通過多個流入流?

 private const SERVER:String = "rtmfp://stratus.adobe.com/"; 
     private const DEVKEY:String = "YOUR-DEVKEY"; 


     [Bindable] 
     private var connected:Boolean = false; 

     private var video:Video; 

     private var netConnection:NetConnection; 
     private var stream:NetStream; 

     private function init():void{ 
      video = new Video(320,240); 
      video.x = 10; 
      video.y = 10; 

      var uic:UIComponent = new UIComponent(); 
      uic.addChild(video); 

      addElement(uic); 

      connect(); 
     } 

     private function connect():void{ 
      netConnection = new NetConnection(); 
      netConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatus); 
      netConnection.connect(SERVER+DEVKEY); 
     } 

     private function netStatus(event:NetStatusEvent):void{ 
      writeText(event.info.code); 

      switch(event.info.code){ 
       case "NetConnection.Connect.Success": 
        setupStream(); 

        break; 
      } 

     } 

     private function setupStream():void{ 
      var groupspec:GroupSpecifier = new GroupSpecifier("myGroup/multicastOne"); 
      groupspec.serverChannelEnabled = true; 
      groupspec.multicastEnabled = true; 

      stream = new NetStream(netConnection,groupspec.groupspecWithAuthorizations()); 
      stream.addEventListener(NetStatusEvent.NET_STATUS, netStatus); 

      stream.play("multicast"); 

      video.attachNetStream(stream); 
     } 

     private function writeText(txt:String):void{ 
      txtHistory.text += txt+"\n"; 
     } 

回答

0

當您使用NetstreamGroupSpecifier,你需要創建一個具有相同GroupSpecifier一個Netgroup

然後

Publisher 1: Netstream.publish("stream1") 
Publisher 2: Netstream.publish("stream2") 

// etc. 

和客戶端:

Netstream.play("stream1"); 
Netstream.play("stream2"); 

// etc.