任何熟悉使用 Cirrus 的人?(http://labs.adobe.com/technologies/cirrus/) 我很难让 onPeerConnect 对象按应有的方式工作。我只需要能够在 ID 附近取一侧并将其交给另一侧。然后当近端尝试连接到远端时,远端应该返回 true 并允许连接,然后同时自行获取连接的 farID farID = subscriber.farID;
(有效,我确认它正在获取 farID)但是当我尝试这个时代码它只是看到它收到垃圾邮件......
TRUE
NetStream.Play.Start
NetStream.Play.Start
NetStream.Connect.Success
NetStream.Connect.Closed
TRUE
TRUE
NetStream.Play.Start
TRUE
NetStream.Play.Start
NetStream.Play.Start
NetStream.Connect.Closed
NetStream.Connect.Success
NetStream.Connect.Closed
TRUE
TRUE
TRUE
NetStream.Play.Start
NetStream.Connect.Closed
TRUE
NetStream.Play.Start
NetStream.Connect.Closed
TRUE
NetStream.Play.Start
TRUE
NetStream.Play.Start
NetStream.Play.Start
NetStream.Connect.Closed
NetStream.Connect.Success
一遍又一遍
那么我怎样才能完成这项工作,就像我说的那样,只有一侧需要与其他 farID 一起提供,然后他们可以相互传递音频和视频?
我一直在重新排列代码几个小时,并client =
在其他事情中使用代码的位置,但仍然没有运气。任何人都可以分享有关该主题的任何见解吗?
//SETUP STREAM FUNCTION
public function setupStream():void
{
//send stream with audio and video;
sendStream = new NetStream(netConnection,NetStream.DIRECT_CONNECTIONS);
sendStream.attachAudio(live_mic);
sendStream.attachCamera(nearCam);
sendStream.addEventListener(NetStatusEvent.NET_STATUS, cirrusStatusHandler);
var c:Object = new Object;
c.onPeerConnect = function(subscriber:NetStream):Boolean {
farID = subscriber.farID;
trace("TRUE");
setupReceiveStream();
return true;
}
sendStream.client = c;
sendStream.publish("media");
}
//receive stream function
public function setupReceiveStream():void
{
receiveStream = new NetStream(netConnection, farID);
//receive stream with audio and video;
receiveStream.client = this;
receiveStream.play("media");
far_video.mx_internal::videoPlayer.attachNetStream(receiveStream);
receiveStream.addEventListener(NetStatusEvent.NET_STATUS, cirrusStatusHandler);
}