private void DisplayVideoWindow(TStream stm, TAPIMEDIATYPES mediaType, TERMINAL_DIRECTION direction) { TTerminal t = stm.FindTerminal(mediaType, direction); if (t != null) { IVideoWindow videoWindow = t.QueryInterface(typeof(IVideoWindow)) as IVideoWindow; if (videoWindow != null) { videoWindow.Owner = (direction == TERMINAL_DIRECTION.TD_RENDER) ? localVidPlaceholder.Handle.ToInt32() : remoteVidPlaceholder.Handle.ToInt32(); videoWindow.WindowStyle = 0x40800000; // WS_CHILD | WS_BORDER; videoWindow.SetWindowPosition(0, 0, localVidPlaceholder.Width, localVidPlaceholder.Height); videoWindow.Visible = 1; } } }
private void OnMediaEvent(object sender, TapiCallMediaEventArgs e) { // When the video rendering stream activates, popup the video window if it's available. if (e.Event == CALL_MEDIA_EVENT.CME_STREAM_ACTIVE) { TStream stm = e.Stream; if (stm.Direction == TERMINAL_DIRECTION.TD_RENDER && stm.MediaType == TAPIMEDIATYPES.VIDEO) { TTerminal t = stm.FindTerminal(stm.MediaType, stm.Direction); if (t != null) { IVideoWindow vw = t.QueryInterface(typeof(IVideoWindow)) as IVideoWindow; if (vw != null) { // Position to the right vw.SetWindowPosition(this.Left + this.Width + 2, this.Top, vw.Width, vw.Height); vw.Visible = 1; } } } else if (currCall != null && stm.Direction == TERMINAL_DIRECTION.TD_CAPTURE && stm.MediaType == TAPIMEDIATYPES.AUDIO && playbackTerminal != null) { try { playbackTerminal.Start(); toolStripStatusLabel1.Text = "File Playback Terminal started "; } catch (TapiException ex) { MessageBox.Show(ex.Message); } } } }