//视频呼叫回复 private void VideoCall_Reply_Handler(int userId,int dwErrorCode,int wParam,string lpStr) { if (this.WindowState == FormWindowState.Minimized) this.WindowState = FormWindowState.Normal; RemoveCallButton(); intCallTimer = 3; ShowCallMessage(Properties.Resources._18, "会话已结束..."); ConversationMode = null; switch(dwErrorCode) { case 0: ConversationMode = new ConversationInfo(); ConversationMode.SuserId = m_UserId; ConversationMode.TuserId = userId; VideoCall_WaitCall_Handler(); break; case AC_ERROR_VIDEOCALL_CANCEL: ShowCallMessage(Properties.Resources._20, "对方取消呼叫..."); break; case AC_ERROR_VIDEOCALL_REJECT: ShowCallMessage(Properties.Resources._5, "对方拒绝会话..."); break; case AC_ERROR_VIDEOCALL_BUSY: ShowCallMessage(Properties.Resources._8, "目标用户正忙,请稍后重试..."); break; case AC_ERROR_VIDEOCALL_OFFLINE: ShowCallMessage(Properties.Resources._18, "对方已离线..."); break; case AC_ERROR_VIDEOCALL_TIMEOUT: ShowCallMessage(Properties.Resources._1, "会话请求已超时..."); break; case AC_ERROR_VIDEOCALL_DISCONNECT: ShowCallMessage(Properties.Resources._18, "对方网络断开..."); break; } if(dwErrorCode!=0) timer_call.Start(); Log.SetLog("VideoCall_Reply_Handler" + dwErrorCode); }
//接收到视频呼叫请求处理 private void VideoCall_Request_Handler(int dwUserId, int dwParam, string lpUserStr) { if (this.WindowState == FormWindowState.Minimized) this.WindowState = FormWindowState.Normal; timer_call.Stop();//关闭计时器,确认状态 ConversationMode = new ConversationInfo(); ConversationMode.SuserId = dwUserId; ConversationMode.TuserId = m_UserId; UserInfo userItem = GetUserInfoByUserId(dwUserId); if (userItem != null) { ShowCallMessage(Properties.Resources._14, userItem.Name + "向您发起视频会话邀请..."); Button btn_accepted = new Button(); btn_accepted.Font = new Font("微软雅黑", 20); btn_accepted.Size = new Size(140, 50); btn_accepted.Location = new Point(pan_call.Width / 2 - btn_accepted.Width - 10, pic_call.Top + pic_call.Height + 30); btn_accepted.Text = "接受"; btn_accepted.Tag = "btn"; btn_accepted.BackColor = Color.Lime; btn_accepted.ForeColor = Color.White; btn_accepted.Click += new EventHandler(btn_accepted_Click); pan_call.Controls.Add(btn_accepted); Button btn_refuse = new Button(); btn_refuse.Font = new Font("微软雅黑", 20); btn_refuse.Size = new Size(140, 50); btn_refuse.Location = new Point(pan_call.Width / 2 + 10, pic_call.Top + pic_call.Height + 30); btn_refuse.Text = "拒绝"; btn_refuse.Tag = "btn"; btn_refuse.BackColor = Color.Red; btn_refuse.ForeColor = Color.White; btn_refuse.Click += new EventHandler(btn_refuse_Click); pan_call.Controls.Add(btn_refuse); SoundPlayer Player = new SoundPlayer(); Player.Stream = Properties.Resources.ring; Player.Play(); Player.Dispose(); } }
// 拒绝视频呼叫邀请 void btn_refuse_Click(object sender, EventArgs e) { //发送视频呼叫回复指令,dwErrcode=100104 AnyChatCoreSDK.VideoCallControl(AnyChatCoreSDK.BRAC_VIDEOCALL_EVENT_REPLY, ConversationMode.SuserId, AC_ERROR_VIDEOCALL_REJECT, 0, 0, ""); ConversationMode = null; InitFaceAfterEndCall(Properties.Resources._5, "已经拒绝会话..."); }
//取消呼叫 private void CanCall() { //发送视频呼叫回复指令,dwErrcode=100101 AnyChatCoreSDK.VideoCallControl(AnyChatCoreSDK.BRAC_VIDEOCALL_EVENT_REPLY, ConversationMode.TuserId, AC_ERROR_VIDEOCALL_CANCEL, 0, 0, ""); ConversationMode = null; InitFaceAfterEndCall(Properties.Resources._20, "已经取消呼叫"); }