/// <summary> /// 关闭 /// </summary> public void Close() { if (this.VC != null) { if (VC != null) { VC.Close(); VC = null; } } }
/// <summary> /// 初始化音视频通信组件 /// </summary> /// <param name="Model">视频显示大小模式</param> public void iniAV(VideoSizeModel Model) { if (!IsIni) IsIni = true;//标识已经初始化 else return; //如果已经初始化,则退出 if (VC == null) { VC = new VideoCapturer(this.cLocal);//创建新的视频捕捉组件 VC.VideoCapturerBefore += new VideoCapturer.VideoCapturerBeforeEventHandler(VC_VideoCapturerBefore); VC.VideoDataCapturered += new VideoCapturer.VideoDataCaptureredEventHandler(VC_VideoDataCapturered); VC.StartVideoCapture(Model);//开始捕捉视频 } if (AE == null) { AE = new AudioEncoder();//创建G711音频编解码器 } if (AC == null) { AC = new AudioCapturer(this.trackBarOut, this.trackBarIn);//创建新的音频捕捉组件 AC.AudioDataCapturered += new AudioCapturer.AudioDataCaptureredEventHandler(AC_AudioDataCapturered); } if (AR == null) { AR = new AudioRender();//创建G711音频回放组件 } }
/// <summary> /// 关闭 /// </summary> public void Close() { try { aVcommunicationEx1.closeCommunication(); } catch (Exception) { } try { aVcommunicationEx1.sockUDP1.CloseSock(); } catch (Exception) { } if (this.VC != null) { if (VC != null) { VC.Close(); VC = null; } } if (VR!=null) { VR = null; } if (VE!=null) { VE.Close(); VE = null; } if (VD!=null) { VD.Close(); VD = null; } if (AC!=null) { AC = null; } if (AR!=null) { AR = null; } if (AE!=null) { AE = null; } }