0

任何熟悉使用 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);

                }
4

2 回答 2

0

您不检查您在 onPeerconnect 中设置的新传入流是否存在。您应该只在不存在时启动新的传入流。这就是为什么它会重复自己。

于 2013-03-26T18:18:37.407 回答