Пример #1
0
        public void AcceptVideo(String otherNeck, IPAddress otherIP, int otherSendPort, int otherRecvPort, VideoMirror.OnFrameReceivedHandler onFRH)
        {
            // 视频收发准备
            int thisSendPort = NetResource.Instance.GetNextUDPPort();
            int thisRecvPort = NetResource.Instance.GetNextUDPPort();

            // 初始化视频
            VideoMgr.InitVideoAsResponse(otherNeck, thisSendPort, thisRecvPort, otherIP, otherSendPort, otherRecvPort, onFRH);

            // 发送接受消息
            String dataStr = System.Convert.ToChar(CProtocol.VideoAccept).ToString();

            dataStr += ((char)System.Text.Encoding.UTF8.GetBytes(otherNeck).Length).ToString();
            dataStr += otherNeck;
            dataStr += ((char)thisSendPort).ToString();
            dataStr += ((char)thisRecvPort).ToString();
            sendData(dataStr);

            // 开始收发视频
            VideoMgr.BeginSession(otherNeck);


            // 另一种方式..
            //          注意参数:           对方昵称   对方EP   自己Port 接受回调
            // VideoMgr.BeginSession(otherNeck, otherEP.Address.ToString(), otherEP.Port, thisPort, onFRH);
        }