Esempio n. 1
0
        private void OnVideoChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            RunAtUI(() =>
            {
                //*****************************************************************************************
                //                              Video Content
                //
                // The video content is only available when the Lync client is running in UISuppressionMode.
                //
                // The video content is not directly accessible as a stream. It's rather available through
                // a video window that can de drawn in any panel or window.
                //
                // The outgoing video is accessible from videoChannel.CaptureVideoWindow
                // The window will be available when the video channel state is either Send or SendReceive.
                //
                // The incoming video is accessible from videoChannel.RenderVideoWindow
                // The window will be available when the video channel state is either Receive or SendReceive.
                //
                //*****************************************************************************************

                _log.Debug("OnVideoChannelStateChanged  OldState:{0} NewState:{1} channel:{2}  channelCode:{3}"
                           , e.OldState.ToString()
                           , e.NewState.ToString()
                           , sender.ToString()
                           , sender.GetHashCode()
                           );


                //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Send ||
                     e.NewState == ChannelState.SendReceive) && _videoChannel.CaptureVideoWindow != null)
                {
                    LocalParticipantVideoModel.View = _videoChannel.CaptureVideoWindow;
                    ShowVideoPartView?.Invoke();
                    //presents the video in the panel
                    //  ShowVideo(panelOutgoingVideo, _videoChannel.CaptureVideoWindow);
                }

                //if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Receive ||
                     e.NewState == ChannelState.SendReceive) && _videoChannel.RenderVideoWindow != null)
                {
                    //presents the video in the panel
                    // SetParticipantVideoWindow(_videoChannel, _videoChannel.RenderVideoWindow);
                }
            });
        }
Esempio n. 2
0
        private void OnParticipantVideoChannelStateChanged(object sender, ChannelStateChangedEventArgs e)
        {
            //posts the execution into the UI thread
            RunAtUI(() =>
            {
                _log.Debug("OnParticipantVideoChannelStateChanged  OldState:{0} NewState:{1} Channel:{2} ChannelCode:{3}"
                           , e.OldState.ToString()
                           , e.NewState.ToString()
                           , sender.ToString()
                           , sender.GetHashCode()
                           );

                var channel = sender as VideoChannel;

                //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
                if ((e.NewState == ChannelState.Send ||
                     e.NewState == ChannelState.SendReceive) && _videoChannel.CaptureVideoWindow != null)
                {
                    ParticipantCollection.UpdateVideoWindow(channel, _videoChannel.CaptureVideoWindow, true);
                    //SetParticipantVideoWindow(channel, _videoChannel.CaptureVideoWindow);
                }


                if (e.NewState == ChannelState.Receive && _videoChannel.RenderVideoWindow != null)
                {
                    if (RemoteConnectParticipantVideoModel != null)
                    {
                        RemoteConnectParticipantVideoModel.View = null;
                    }
                    RemoteConnectParticipantVideoModel = null;
                }


                //if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
                if (
                    e.NewState == ChannelState.SendReceive && _videoChannel.RenderVideoWindow != null)
                {
                    ParticipantCollection.UpdateVideoWindow(channel, _videoChannel.RenderVideoWindow, false);

                    ShowVideoPartView?.Invoke();

                    SetParticipantVideoWindow(channel, _videoChannel.RenderVideoWindow);
                }
            });
        }