コード例 #1
0
        /// <summary>
        /// red5视频请求
        /// </summary>
        /// <param name="msg"></param>
        private void Red5AccpetMethod(XMPP.protocol.client.Message msg)
        {
            if (InvokeRequired)
            {
                this.Invoke(Red5AccpetEvent, new object[]{msg});
            }

            if (red5MsgReceive != null)
                if (!red5MsgReceive.IsDisposed)
                    return;

            DialogResult result=MsgBox.Show(this, "CSS&IM", "好友" + NickName + "向您发送视频请求,是否接受!", MessageBoxButtons.YesNo);

            if (result==DialogResult.Yes)
            {
                string serUrl = @"http://"+Program.ServerIP+":7070/redfire/video/redfire_2way.html?me={0}&you={1}&key={2}";
                red5MsgReceive = new Red5Msg();
                red5MsgReceive.FriendName = "正在与[" + msg.GetTag("me").ToString() + "]视频通话中";
                red5MsgReceive.FormClosing += new FormClosingEventHandler(red5MsgReceive_FormClosing);
                red5MsgReceive.Accept(string.Format(serUrl, msg.GetTag("you").ToString(), msg.GetTag("me").ToString(), msg.GetTag("key").ToString()));
                red5MsgReceive.Show();
                this.AppendSystemRtf("开始与" + msg.GetTag("me").ToString() + "进行视频通话");
            }
            else
            {
                CSS.IM.XMPP.protocol.client.Message emsg = new CSS.IM.XMPP.protocol.client.Message();
                emsg.Type = MessageType.chat;
                emsg.To = TO_Jid;
                emsg.SetTag("m_type", 12);
                emsg.SetTag("me", msg.GetTag("me").ToString());
                emsg.SetTag("you", msg.GetTag("you").ToString());
                emsg.SetTag("key", msg.GetTag("key").ToString());
                XmppConn.Send(emsg);
                this.AppendSystemRtf("拒绝了" + msg.GetTag("me").ToString() + "视频通话");
            }
        }
コード例 #2
0
        /// <summary>
        /// 视频发送请求
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_videoOpen_Click(object sender, EventArgs e)
        {
            if (!OnLine)
                return;

            string keyValue=Guid.NewGuid().ToString().Replace("-","");

            try
            {
                //if (avForm != null)
                //    if (!avForm.IsDisposed)
                //        return;

                //if (ravForm != null)
                //    if (!ravForm.IsDisposed)
                //        return;

                //avForm = new CSS.IM.App.Controls.AVForm(TO_Jid);
                //avForm.AVCloseEvent += new CSS.IM.App.Controls.AVForm.AVCloseDelegate(avForm_AVCloseEvent);
                //ListenVideoUDPPort = avForm.aVcommunicationEx1.selfUDPPort;

                //avForm.Show();

                if (red5MsgSend != null)
                    if (!red5MsgSend.IsDisposed)
                        return;

                if (red5MsgReceive != null)
                    if (!red5MsgReceive.IsDisposed)
                        return;

                string serUrl = @"http://" + Program.ServerIP + ":7070/redfire/video/redfire_2way.html?me={0}&you={1}&key={2}";
                red5MsgSend = new Red5Msg();
                red5MsgSend.FriendName = "正在与[" + TO_Jid.User + "]视频通话中";
                red5MsgSend.FormClosing += new FormClosingEventHandler(red5MsgSend_FormClosing);
                red5MsgSend.Cell(string.Format(serUrl, XmppConn.MyJID.User, TO_Jid.User, keyValue));
                red5MsgSend.Show();

                CSS.IM.XMPP.protocol.client.Message msg = new CSS.IM.XMPP.protocol.client.Message();
                msg.Type = MessageType.chat;
                msg.To = TO_Jid;
                msg.SetTag("m_type", 11);
                msg.SetTag("me", XmppConn.MyJID.User);
                msg.SetTag("you", TO_Jid.User);
                msg.SetTag("key", keyValue);
                XmppConn.Send(msg);

                this.AppendSystemRtf("向" + TO_Jid.User+"发送了视频请求,等待回应");

            }
            catch (Exception)
            {

            }

            //CSS.IM.XMPP.protocol.client.Message msg = new CSS.IM.XMPP.protocol.client.Message();
            //msg.Type = MessageType.chat;
            //msg.To = TO_Jid;
            //msg.SetTag("m_type", 1);
            //msg.SetTag("UDPPort", ListenVideoUDPPort);
            //msg.SetTag("UDPIP", Program.LocalHostIP.ToString());
            //XmppConn.Send(msg);

            ////callSoundPlayer.PlayLooping();
            ////SoundPlayEx.MsgPlay("call");
        }