Esempio n. 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();
                }
            }
        }
Esempio n. 2
0
        public void RtsTest()
        {
            VideoChatForm vchatForm = VideoChatForm.GetInstance();
            RtsForm       rtsForm   = RtsForm.GetInstance();


            //当前不存在白板会话和音视频会话,才能开启新的会话
            if (rtsForm.RtsState == RtsFormState.kRtsInit && vchatForm.VchatInfo.state == VChatState.kVChatUnknow)
            {
                rtsForm.Show();
                rtsForm.SetRtsInfo("", _peerId, (NIM.NIMRts.NIMRtsChannelType.kNIMRtsChannelTypeTcp | NIM.NIMRts.NIMRtsChannelType.kNIMRtsChannelTypeVchat));
                rtsForm.RtsState = RtsFormState.kRtsInvite;
            }
            else
            {
                if (rtsForm.RtsState != RtsFormState.kRtsInit)
                {
                    rtsForm.Activate();
                }
                if (vchatForm.VchatInfo.state != VChatState.kVChatUnknow)
                {
                    vchatForm.Activate();
                }
            }
            //rtsForm.SetRtsInfo
        }
Esempio n. 3
0
 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);
         }
     }
 }
Esempio n. 4
0
 void OnReceiveSessionRequest(string sessionId, int channelType, string uid, string custom)
 {
     InvokeOnForm(() =>
     {
         VideoChatForm vchatForm = VideoChatForm.GetInstance();
         RtsForm rtsForm         = RtsForm.GetInstance();
         //当前不存在白板会话和音视频会话,才能开启新的会话
         if (rtsForm.RtsState == RtsFormState.kRtsInit && vchatForm.VchatInfo.state == VChatState.kVChatUnknow)
         {
             rtsForm.Show();
             rtsForm.RtsState = RtsFormState.kRtsNotify;
             rtsForm.SetRtsInfo(sessionId, uid, (NIM.NIMRts.NIMRtsChannelType)channelType);
         }
         else
         {
             NIM.RtsAPI.Ack(sessionId, (NIM.NIMRts.NIMRtsChannelType)channelType, false, null, null);
         }
     });
 }