public void Initialize(IMultimediaManager mgr, string chatGroupID) { this.multimediaManager = mgr; this.chatGroup = this.multimediaManager.ChatGroupEntrance.Join(ChatType.Video, chatGroupID); this.decibelDisplayer_mic.Working = true; this.decibelDisplayer_speaker.Working = true; this.multimediaManager.AudioCaptured += new ESBasic.CbGeneric <byte[]>(multimediaManager_AudioCaptured); this.multimediaManager.AudioPlayed += new ESBasic.CbGeneric <byte[]>(multimediaManager_AudioPlayed); this.chatGroup.SomeoneJoin += new ESBasic.CbGeneric <IChatUnit>(chatGroup_SomeoneJoin); this.chatGroup.SomeoneExit += new CbGeneric <string>(chatGroup_SomeoneExit); VideoPanel myselfPanel = new VideoPanel(); this.flowLayoutPanel1.Controls.Add(myselfPanel); myselfPanel.Initialize(this.chatGroup.MyChatUnit, true); foreach (IChatUnit unit in this.chatGroup.GetOtherMembers()) { VideoPanel panel = new VideoPanel(); this.flowLayoutPanel1.Controls.Add(panel); panel.Initialize(unit, false); } this.groupBox_members.Text = string.Format("成员列表({0}人)", this.flowLayoutPanel1.Controls.Count); this.flowLayoutPanel1_SizeChanged(this.flowLayoutPanel1, new EventArgs()); }
public void StartOMCSClient(UserDto CurrentUser, string roomId) { try { multimediaManager = MultimediaManagerFactory.GetSingleton(); multimediaManager.CameraVideoSize = new Size(320, 240); multimediaManager.AutoAdjustCameraEncodeQuality = false; multimediaManager.ChannelMode = ChannelMode.P2PDisabled; multimediaManager.SecurityLogEnabled = false; multimediaManager.CameraDeviceIndex = 0; multimediaManager.MicrophoneDeviceIndex = ConfigEntity.MicrophoneIndex; multimediaManager.SpeakerIndex = ConfigEntity.SpeakerIndex; multimediaManager.DesktopEncodeQuality = 3; multimediaManager.AutoReconnect = true; multimediaManager.Initialize(CurrentUser.UserName, "", ConfigEntity.SocketServerIp, ConfigEntity.AudioPort); this.chatGroup = this.multimediaManager.ChatGroupEntrance.Join(ChatType.Audio, roomId); this.chatGroup.SomeoneJoin += chatGroup_SomeoneJoin; this.chatGroup.SomeoneExit += chatGroup_SomeoneExit; foreach (IChatUnit unit in this.chatGroup.GetOtherMembers()) { unit.MicrophoneConnector.BeginConnect(unit.MemberID); } if (multimediaManager.Available) { DisplayMsg("语音服务已经连接成功."); } } catch (Exception ex) { DisplayMessage(ex.Message); } }
/// <summary> /// 关闭答疑室 /// </summary> public void Close() { if (this.multimediaManager != null) { //退出聊天室 if (chatGroup != null) { this.multimediaManager.ChatGroupEntrance.Exit(ChatType.Audio, this.chatGroup.GroupID); } chatGroup = null; if (CameraControl != null) { if (CameraControl.Connected) { CameraControl.Disconnect(); } } if (WhiteBoardControl != null) { if (WhiteBoardControl.Connected) { WhiteBoardControl.Disconnect(); } } } }
/// <summary> /// 加入答疑室 /// </summary> /// <param name="chatGroupID">组ID</param> public void JoinChatGroup(string chatGroupID, string teacherID) { //退出上一次答疑室 if (chatGroup != null) { this.multimediaManager.ChatGroupEntrance.Exit(ChatType.Audio, this.chatGroup.GroupID); Builder = null; memberList.ForEach(chatMember => { chatMember.Dispose(); }); memberList.Clear(); } //加入答疑室 if (CameraControl != null) { this.CameraControl.BeginConnect(teacherID); } if (WhiteBoardControl != null) { this.WhiteBoardControl.BeginConnect(chatGroupID); } this.chatGroup = multimediaManager.ChatGroupEntrance.Join(ChatType.Audio, chatGroupID); this.chatGroup.SomeoneJoin += OnChatGroup_SomeoneJoin; this.chatGroup.SomeoneExit += OnChatGroup_SomeoneExit; this.GroupName = chatGroupID; //获取已在答疑室的成员 加入列表 foreach (IChatUnit unit in this.chatGroup.GetOtherMembers()) { ChatMember member = new ChatMember(unit); memberList.Add(member); } this.Builder = this.memberList.Find(a => { return(a.MemberID == teacherID); }); }
public void Initialize(IMultimediaManager mgr, string chatGroupID) { this.multimediaManager = mgr; this.chatGroup = this.multimediaManager.ChatGroupEntrance.Join(ChatType.Video, chatGroupID); this.decibelDisplayer_mic.Working = true; this.decibelDisplayer_speaker.Working = true; this.multimediaManager.AudioCaptured += new ESBasic.CbGeneric<byte[]>(multimediaManager_AudioCaptured); this.multimediaManager.AudioPlayed += new ESBasic.CbGeneric<byte[]>(multimediaManager_AudioPlayed); this.chatGroup.SomeoneJoin += new ESBasic.CbGeneric<IChatUnit>(chatGroup_SomeoneJoin); this.chatGroup.SomeoneExit += new CbGeneric<string>(chatGroup_SomeoneExit); SpeakerVideoPanel myselfPanel = new SpeakerVideoPanel(); this.flowLayoutPanel1.Controls.Add(myselfPanel); myselfPanel.Initialize(this.chatGroup.MyChatUnit, true); foreach (IChatUnit unit in this.chatGroup.GetOtherMembers()) { SpeakerVideoPanel panel = new SpeakerVideoPanel(); this.flowLayoutPanel1.Controls.Add(panel); panel.Initialize(unit, false); } this.groupBox_members.Text = string.Format("成员列表({0}人)" ,this.flowLayoutPanel1.Controls.Count); this.flowLayoutPanel1_SizeChanged(this.flowLayoutPanel1, new EventArgs()); }
public void Initialize(IMultimediaManager mgr, string chatGroupID) { this.multimediaManager = mgr; this.chatGroup = this.multimediaManager.ChatGroupEntrance.Join(ChatType.Video, chatGroupID); this.decibelDisplayer_mic.Working = true; this.decibelDisplayer_speaker.Working = true; this.multimediaManager.AudioCaptured += new ESBasic.CbGeneric <byte[]>(multimediaManager_AudioCaptured); this.multimediaManager.AudioPlayed += new ESBasic.CbGeneric <byte[]>(multimediaManager_AudioPlayed); this.chatGroup.SomeoneJoin += new ESBasic.CbGeneric <IChatUnit>(chatGroup_SomeoneJoin); this.chatGroup.SomeoneExit += new CbGeneric <string>(chatGroup_SomeoneExit); VideoPanel myselfPanel = new VideoPanel(); this.flowLayoutPanel1.Controls.Add(myselfPanel); myselfPanel.Initialize(this.chatGroup.MyChatUnit, true); //myselfPanel.Visible = false; myselfPanel.InitializeVideo(this.chatGroup.MyChatUnit, true); //版本0328 string user_id = this.chatGroup.MyChatUnit.MemberID; if (user_id.Equals("会议室2")) //如果myself是网格中心的话,聊天组里面的全部显示 { foreach (IChatUnit unit in this.chatGroup.GetOtherMembers()) { VideoPanel panel0 = new VideoPanel(); this.flowLayoutPanel1.Controls.Add(panel0); //panel.Visible = false; panel0.Initialize(unit, false); panel0.InitializeVideo(unit, false); } } else //如果myself不是的话,判断聊天组里有没有网格zx,如果有仅显示网格zx { foreach (IChatUnit unit in this.chatGroup.GetOtherMembers()) { if (unit.MemberID.Equals("会议室2")) { VideoPanel panel1 = new VideoPanel(); this.flowLayoutPanel1.Controls.Add(panel1); //panel.Visible = false; panel1.Initialize(unit, false); panel1.InitializeVideo(unit, false); } else { VideoPanel panel2 = new VideoPanel(); this.flowLayoutPanel1.Controls.Add(panel2); panel2.Visible = false; panel2.Initialize(unit, false); } } } this.groupBox_members.Text = string.Format("成员列表({0}人)", this.flowLayoutPanel1.Controls.Count); this.flowLayoutPanel1_SizeChanged(this.flowLayoutPanel1, new EventArgs()); }