Esempio n. 1
0
        private void FriendsListForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (_exitType == MainFormExitType.Exit)
            {
                if (_nrtcInit)
                {
                    //退出前需要结束音视频设备,防止错误的数据上报
                    MultimediaHandler.EndDevices();
                    System.Threading.Thread.Sleep(500);
                    //在释放前需要按步骤清理音视频模块和nim client模块
                    NIM.VChatAPI.Cleanup();
                }

                if (!_beKicked)
                {
                    System.Threading.Semaphore s = new System.Threading.Semaphore(0, 1);
                    NIM.ClientAPI.Logout(NIM.NIMLogoutType.kNIMLogoutAppExit, (r) =>
                    {
                        s.Release();
                    });
                    //需要logout执行完才能退出程序
                    s.WaitOne(TimeSpan.FromSeconds(10));
                    NIM.ClientAPI.Cleanup();
                }

                Application.Exit();
            }
        }
Esempio n. 2
0
 private void InitVChatHandler()
 {
     System.Threading.ThreadPool.QueueUserWorkItem((args) =>
     {
         MultimediaHandler.GetInstance().Init(this);
     });
 }
Esempio n. 3
0
 public static MultimediaHandler GetInstance()
 {
     if (media_handler == null)
     {
         media_handler = new MultimediaHandler();
     }
     return(media_handler);
 }
        void MultiVChatForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            NIM.VChatAPI.End();
            _multiVChatFormGraphics_pb01.Dispose();
            _multiVChatFormGraphics_pb02.Dispose();
            _multiVChatFormGraphics_pb03.Dispose();
            _multiVChatFormGraphics_pb04.Dispose();

            //将音视频通知重新交回给p2p
            MultimediaHandler.InitVChatInfo();
        }
        public MultiVChatForm(string roomId)
        {
            InitializeComponent();
            this._roomId = roomId;

            cm = new System.Windows.Forms.ContextMenu();

            this.Text += "房间号:" + roomId;
            rtb_multichat_info.Text += "欢迎进入房间\n";
            this.tb_roomid.Text      = roomId;
            this.Load       += MultiVChatForm_Load;
            this.FormClosed += MultiVChatForm_FormClosed;
            MultimediaHandler.GetInstance().PeopleStatusHandler += OnMultiChatStatus;
            this.lv_members.Items.Add(NIMDemo.Helper.UserHelper.SelfId, NIMDemo.Helper.UserHelper.SelfId, 0);
        }
 private void InitVChat()
 {
     System.Threading.ThreadPool.QueueUserWorkItem((args) =>
     {
         try
         {
             if (_nrtcInit = NIM.VChatAPI.Init(""))
             {
                 MultimediaHandler.GetInstance().Init(this);
             }
             else
             {
                 MessageBox.Show("NIM VChatAPI init failed!");
             }
         }
         catch (Exception exception)
         {
             System.Diagnostics.Debug.WriteLine(exception.ToString());
         }
     });
 }