Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            VideoChatForm vchatForm = VideoChatForm.GetInstance();
            RtsForm       rtsForm   = RtsForm.GetInstance();

            //当前不存在白板会话和音视频会话,才能开启新的会话
            if (rtsForm.RtsState == RtsFormState.kRtsInit && vchatForm.VchatInfo.state == VChatState.kVChatUnknow)
            {
                VideoChatInfo vchat_info = vchatForm.VchatInfo;
                vchat_info.state     = VChatState.kVChatInvite;
                vchat_info.uid       = _peerId;
                vchat_info.chat_mode = NIMVideoChatMode.kNIMVideoChatModeVideo;
                vchatForm.VchatInfo  = vchat_info;
                vchatForm.Show();
            }
            else
            {
                if (rtsForm.RtsState != RtsFormState.kRtsInit)
                {
                    rtsForm.Activate();
                }
                else if (vchatForm.VchatInfo.state != VChatState.kVChatUnknow)
                {
                    vchatForm.Activate();
                }
            }
        }
 private static void OnSessionInviteNotify(long channel_id, string uid, int mode, long time, string custom_info)
 {
     if (GetInstance().channel_id != 0 && channel_id != GetInstance().channel_id)
     {
         NIM.NIMVChatInfo info = new NIM.NIMVChatInfo();
         NIM.VChatAPI.CalleeAck(channel_id, false, info);
     }
     else
     {
         VideoChatForm vform      = VideoChatForm.GetInstance();
         RtsForm       rtsForm    = RtsForm.GetInstance();
         VideoChatInfo vchat_info = vform.VchatInfo;
         //当前不存在rts会话和音视频会话,才能开启新的会话
         if (rtsForm.RtsState == RtsFormState.kRtsInit && vchat_info.state == VChatState.kVChatUnknow)
         {
             vchat_info.channel_id = channel_id;
             vchat_info.uid        = uid;
             vchat_info.state      = VChatState.kVChatNotify;
             vchat_info.chat_mode  = (NIMVideoChatMode)mode;
             vform.VchatInfo       = vchat_info;
             Action a = () =>
             {
                 vform.Show();
             };
             _ownerMainForm.BeginInvoke(a);
         }
         else
         {
             NIM.NIMVChatInfo info = new NIM.NIMVChatInfo();
             NIM.VChatAPI.CalleeAck(channel_id, false, info);
         }
     }
 }