/// <summary> /// Dispose of the unmanaged resources. /// </summary> public void DisposeCall() { // Check to see if Dispose has already been called. if (!this._disposed) { // Note disposing has been done. _disposed = true; try { // If disposing equals true, dispose all managed // and unmanaged resources. if (_window != null) { _window.Dispose(); } } catch { } try { // The video preview. if (_videoPreview != null) { _videoPreview.Dispose(); } } catch { } // Call the appropriate methods to clean up // unmanaged resources here. _window = null; _videoPreview = null; } }
/// <summary> /// Create the preview. /// </summary> private void Create() { try { // Get the current video capture device id. int videoCapID = _voipCall.VoIPManager.MediaManager.GetVideoCaptureDeviceID(); int videoRenID = _voipCall.VoIPManager.MediaManager.GetVideoRenderDeviceID(); // If a capture device exist. if (videoCapID >= -1) { // Create. _videoPreview = new Nequeo.Net.PjSip.VideoPreview(videoCapID); // Configure. Nequeo.Net.PjSip.VideoPreviewOpParam parm = new Nequeo.Net.PjSip.VideoPreviewOpParam(); Nequeo.Net.PjSip.VideoWindowHandle handle = new Nequeo.Net.PjSip.VideoWindowHandle(); handle.Type = Nequeo.Net.PjSip.VideoDeviceHandleType.PJMEDIA_VID_DEV_HWND_TYPE_WINDOWS; Nequeo.Net.PjSip.MediaFormat format = new Nequeo.Net.PjSip.MediaFormat(); format.Type = Nequeo.Net.PjSip.MediaType.PJMEDIA_TYPE_VIDEO; // Assign. parm.Show = false; parm.Format = format; parm.WindowFlags = 0; parm.RenderID = videoRenID; parm.Window = handle; // Show. _videoPreview.Start(parm); _window = _videoPreview.GetVideoWindow(); } } catch { } }