void InitChat() { string path = Application.StartupPath; SystemSetting.Text_OnReceive = new TextReceivedHandler(Received_Text); //文本回调涵数 SystemSetting.TransBuffer_OnReceive = new TransBufferReceivedHandler(Received_TransBuffer); //透明通道传输回调 SystemSetting.TransFile_OnReceive = new TransFileReceivedHandler(Received_TransFile); //文件传输回调 AnyChatCoreSDK.SetSDKOption(AnyChatCoreSDK.BRAC_SO_CORESDK_PATH, path, path.Length); SystemSetting.Init(this.Handle); ////设置视频分辨率 //int m_Refw = AnyChatCoreSDK.SetSDKOption(AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_WIDTHCTRL, ref frmLogin.m_LocalVideoWidth, sizeof(int)); //int m_Refh = AnyChatCoreSDK.SetSDKOption(AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_HEIGHTCTRL, ref frmLogin.m_LocalVideoHeight, sizeof(int)); ////应用本地视频编码参数,使得前述修改即时生效(参数为int型:1 使用新参数,0 使用默认参数) //int m_AppLocal = 1; //AnyChatCoreSDK.SetSDKOption(AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_APPLYPARAM, ref m_AppLocal, sizeof(int)); //StringBuilder m_ServerKey = new StringBuilder(); //m_ServerKey.Append("d"); //int retkey = AnyChatCoreSDK.SetServerAuthPass(m_ServerKey); int ret = AnyChatCoreSDK.Connect(frmLogin.m_VideoServerIP, frmLogin.m_VideoTcpPort); ret = AnyChatCoreSDK.Login(frmLogin.m_UserName, "", 0); }
// 2013-05-24: GreenRose Created private void InitAllSetting() { AnyChatCoreSDK.SetNotifyMessageCallBack(OnNotifyMessageCallback, 0); AnyChatCoreSDK.SetVideoDataCallBack(AnyChatCoreSDK.PixelFormat.BRAC_PIX_FMT_RGB24, OnVideoDataCallback, 0); // 2014-01-17: GreenRose AnyChatCoreSDK.SetRecordCallBack(OnRecordCallBack, 0); ulong dwFuncMode = AnyChatCoreSDK.BRAC_FUNC_VIDEO_CBDATA | AnyChatCoreSDK.BRAC_FUNC_AUDIO_AUTOPLAY | AnyChatCoreSDK.BRAC_FUNC_CHKDEPENDMODULE | AnyChatCoreSDK.BRAC_FUNC_AUDIO_VOLUMECALC | AnyChatCoreSDK.BRAC_FUNC_NET_SUPPORTUPNP | AnyChatCoreSDK.BRAC_FUNC_FIREWALL_OPEN | AnyChatCoreSDK.BRAC_FUNC_AUDIO_AUTOVOLUME | AnyChatCoreSDK.BRAC_FUNC_CONFIG_LOCALINI; AnyChatCoreSDK.InitSDK(IntPtr.Zero, dwFuncMode); //AnyChatCoreSDK.Connect("demo.anychat.cn", 8906); //AnyChatCoreSDK.Connect("98.126.164.98", 8906); //AnyChatCoreSDK.Connect("192.168.0.2", 8906); AnyChatCoreSDK.Connect(Login._ServerServiceUri, 8906); AnyChatCoreSDK.Login("1", "", 0); AnyChatCoreSDK.EnterRoom(1, "", 0); NotifyMessageHandler = new AnyChatCoreSDK.NotifyMessage_CallBack(NotifyMessageCallbackDelegate); VideoDataHandler = new AnyChatCoreSDK.VideoData_CallBack(VideoDataCallbackDelegate); RecordHandler = new AnyChatCoreSDK.RecordCallBack(RecordDataCallBackDelegate); }
//单击登录 private void btn_login_Click(object sender, EventArgs e) { //应用签名 string signStr = string.Empty; //签名时间戳 int signTimestamp = 0; try { if (tb_name.Text != "") { string addr = ""; int port = 8906; try { addr = tb_serveradd.Text; port = Convert.ToInt32(tb_port.Text); m_userName = tb_name.Text; } catch (Exception) { ShowMessage("配置有误"); } if (hallForm != null && !hallForm.bReleased) { AnyChatCoreSDK.Logout(); AnyChatCoreSDK.Release(); } SystemSetting.Init(this.Handle); /* AnyChat可以连接自主部署的服务器、也可以连接AnyChat视频云平台; * 连接自主部署服务器的地址为自设的服务器IP地址或域名、端口; * 连接AnyChat视频云平台的服务器地址为:cloud.anychat.cn;端口为:8906 */ AnyChatCoreSDK.Connect(addr, port); /* * AnyChat支持多种用户身份验证方式,包括更安全的签名登录, * 详情请参考:http://bbs.anychat.cn/forum.php?mod=viewthread&tid=2211&highlight=%C7%A9%C3%FB */ int ret = AnyChatCoreSDK.Login(m_userName, "123", 0);//登录系统 } else { ShowMessage("用户名不能为空"); } } catch (Exception ex) { Log.SetLog("VideoChat.Login.btn_login_Click btn_login_Click:" + ex.Message.ToString()); } }
void InitChat() { string path = Application.StartupPath; SystemSetting.Text_OnReceive = new TextReceivedHandler(Received_Text); SystemSetting.TransFile_Received = new TransFileReceivedHandler(Received_TransFile); AnyChatCoreSDK.SetSDKOption(AnyChatCoreSDK.BRAC_SO_CORESDK_PATH, path, path.Length); SystemSetting.Init(this.Handle); int ret = AnyChatCoreSDK.Connect("demo.anychat.cn", 8906); ret = AnyChatCoreSDK.Login("user2", "", 0); }
private void buttonStart_Click(object sender, RoutedEventArgs e) { // 设置回调函数 AnyChatCoreSDK.SetNotifyMessageCallBack(OnNotifyMessageCallback, 0); AnyChatCoreSDK.SetVideoDataCallBack(AnyChatCoreSDK.PixelFormat.BRAC_PIX_FMT_RGB24, OnVideoDataCallback, 0); ulong dwFuncMode = AnyChatCoreSDK.BRAC_FUNC_VIDEO_CBDATA | AnyChatCoreSDK.BRAC_FUNC_AUDIO_AUTOPLAY | AnyChatCoreSDK.BRAC_FUNC_CHKDEPENDMODULE | AnyChatCoreSDK.BRAC_FUNC_AUDIO_VOLUMECALC | AnyChatCoreSDK.BRAC_FUNC_NET_SUPPORTUPNP | AnyChatCoreSDK.BRAC_FUNC_FIREWALL_OPEN | AnyChatCoreSDK.BRAC_FUNC_AUDIO_AUTOVOLUME | AnyChatCoreSDK.BRAC_FUNC_CONFIG_LOCALINI; // 初始化SDK AnyChatCoreSDK.InitSDK(IntPtr.Zero, dwFuncMode); AnyChatCoreSDK.Connect("demo.anychat.cn", 8906); AnyChatCoreSDK.Login("WFP", "", 0); AnyChatCoreSDK.EnterRoom(1, "", 0); NotifyMessageHandler = new AnyChatCoreSDK.NotifyMessage_CallBack(NotifyMessageCallbackDelegate); VideoDataHandler = new AnyChatCoreSDK.VideoData_CallBack(VideoDataCallbackDelegate); }
//单击登录 private void btn_login_Click(object sender, EventArgs e) { try { if (cbox_userIdentity.Text != "") { string addr = ""; int port = 8906; try { addr = cbox_serverIP.Text; port = Convert.ToInt32(cbox_port.Text); m_userName = cbox_userName.Text; m_userIdentity = (UserIdentityType)cbox_userIdentity.SelectedIndex; m_identityPriority = Int32.Parse(cbox_identityPriority.Text); } catch (Exception) { ShowMessage("配置有误"); } if (hallForm != null && !hallForm.bReleased) { AnyChatCoreSDK.Logout(); AnyChatCoreSDK.Release(); } SystemSetting.Init(this.Handle); AnyChatCoreSDK.Connect(addr, port); } else { ShowMessage("用户名不能为空"); } } catch (Exception ex) { Log.SetLog("QueueClient.Login.btn_login_Click btn_login_Click:" + ex.Message.ToString()); ShowMessage(ex.Message.ToString()); } }
//单击登录 private void btn_login_Click(object sender, EventArgs e) { try { if (tb_name.Text != "") { string addr = ""; int port = 8906; try { addr = tb_serveradd.Text; port = Convert.ToInt32(tb_port.Text); m_userName = tb_name.Text; } catch (Exception) { ShowMessage("配置有误"); } if (hallForm != null && !hallForm.bReleased) { AnyChatCoreSDK.Logout(); AnyChatCoreSDK.Release(); } SystemSetting.Init(this.Handle); AnyChatCoreSDK.Connect(addr, port); } else { ShowMessage("用户名不能为空"); } } catch (Exception ex) { Log.SetLog("VideoChat.Login.btn_login_Click btn_login_Click:" + ex.Message.ToString()); } }
//单击登录 private void btn_login_Click(object sender, EventArgs e) { try { if (cbox_userIdentity.Text != "") { string addr = ""; int port = 8906; try { addr = cbox_serverIP.Text; port = Convert.ToInt32(cbox_port.Text); m_userName = cbox_userName.Text; m_userIdentity = (UserIdentityType)cbox_userIdentity.SelectedIndex; m_identityPriority = Int32.Parse(cbox_identityPriority.Text); if (m_userIdentity == UserIdentityType.Agent) { if (cmbBox_Router.SelectedIndex == 1) { m_isAutoRouter = true; } else { m_isAutoRouter = false; } } } catch (Exception) { ShowMessage("配置有误"); } if (hallForm != null && !hallForm.bReleased) { AnyChatCoreSDK.Logout(); AnyChatCoreSDK.Release(); } SystemSetting.Init(this.Handle); /* AnyChat可以连接自主部署的服务器、也可以连接AnyChat视频云平台; * 连接自主部署服务器的地址为自设的服务器IP地址或域名、端口; * 连接AnyChat视频云平台的服务器地址为:cloud.anychat.cn;端口为:8906 */ AnyChatCoreSDK.Connect(addr, port); /* * AnyChat支持多种用户身份验证方式,包括更安全的签名登录, * 详情请参考:http://bbs.anychat.cn/forum.php?mod=viewthread&tid=2211&highlight=%C7%A9%C3%FB */ int ret = AnyChatCoreSDK.Login(m_userName, "123", 0);//登录系统 RecordLoginTrace(); } else { ShowMessage("用户名不能为空"); } } catch (Exception ex) { Log.SetLog("QueueClient.Login.btn_login_Click btn_login_Click:" + ex.Message.ToString()); ShowMessage(ex.Message.ToString()); } }