Actionscript 3 在netgroup p2p多播(adobe cirrus)中接收多个传入流
以下是使用adobe cirrus的多播p2p视频流的接收器部分 我想从多个广播公司接收流并将其作为单独的视频流播放,如何在多播中循环通过多个传入流Actionscript 3 在netgroup p2p多播(adobe cirrus)中接收多个传入流,actionscript-3,p2p,multicast,adobe-cirrus,Actionscript 3,P2p,Multicast,Adobe Cirrus,以下是使用adobe cirrus的多播p2p视频流的接收器部分 我想从多个广播公司接收流并将其作为单独的视频流播放,如何在多播中循环通过多个传入流 private const SERVER:String = "rtmfp://stratus.adobe.com/"; private const DEVKEY:String = "YOUR-DEVKEY"; [Bindable] private var connected:Boo
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";
}
将
Netstream
与GroupSpecifier
一起使用时,需要使用相同的GroupSpecifier
创建Netgroup
然后
和客户:
Netstream.play("stream1");
Netstream.play("stream2");
// etc.
Netstream.play("stream1");
Netstream.play("stream2");
// etc.