Example #1
0
        internal void StopVideo()
        {
            //removes video from the conversation
            AsyncCallback callback = new AsyncOperationHandler(videoChannel.EndStop).Callback;

            try
            {
                videoChannel.BeginStop(callback, null);
            }
            catch (LyncClientException lyncClientException)
            {
                Console.WriteLine(lyncClientException);
            }
            catch (SystemException systemException)
            {
                if (Utilities.IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }
        }
Example #2
0
        /// <summary>
        /// 关闭音视频
        /// </summary>
        public static void Close_AV(ConversationWindow conversationWindow)
        {
            try
            {
                AVModality avModality = (AVModality)conversationWindow.Conversation.SelfParticipant.Modalities[ModalityTypes.AudioVideo];
                if (avModality != null)
                {
                    AudioChannel audioChannel = avModality.AudioChannel;
                    if (audioChannel != null && audioChannel.CanInvoke(ChannelAction.Stop))
                    {
                        audioChannel.BeginStop(null, null);
                    }

                    VideoChannel videoChannel = avModality.VideoChannel;

                    if (videoChannel != null && videoChannel.CanInvoke(ChannelAction.Stop))
                    {
                        videoChannel.BeginStop(null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(LyncHelper), ex);
            }
            finally
            {
            }
        }