private void CurrentCall_onMediaChanged(MediaChangedEvent mediaChgEvent)
        {
            RefreshAudioVideoCtrlView();

            if (mediaChgEvent is RemoteVideoReadyEvent)
            {
                //if dial API not set view handle, you can set them on these VideoReady events.
                //Application.Current.Dispatcher.Invoke(() =>
                //{
                //    currentCall.setRemoteView(curCallView.RemoteViewHandle);
                //});
            }
            else if (mediaChgEvent is LocalVideoReadyEvent)
            {
                //if dial API not set view handle, you can set them on these VideoReady events.
                //Application.Current.Dispatcher.Invoke(() =>
                //{
                //    currentCall.setLocalView(curCallView.LocalViewHandle);
                //});
            }
            else if (mediaChgEvent is LocalVideoViewSizeChangedEvent)
            {
                output($"remote video size: width[{mediaChgEvent.Call.LocalVideoViewSize.Width}] height[{mediaChgEvent.Call.LocalVideoViewSize.Height}]");
                this.AspectRatioLocalVedio = mediaChgEvent.Call.LocalVideoViewSize.Width / (double)mediaChgEvent.Call.LocalVideoViewSize.Height;
            }
            else if (mediaChgEvent is RemoteVideoViewSizeChangedEvent)
            {
                output($"remote video size: width[{mediaChgEvent.Call.RemoteVideoViewSize.Width}] height[{mediaChgEvent.Call.RemoteVideoViewSize.Height}]");
                this.AspectRatioRemoteVedio = mediaChgEvent.Call.RemoteVideoViewSize.Width / (double)mediaChgEvent.Call.RemoteVideoViewSize.Height;
            }
            else if (mediaChgEvent is RemoteShareViewSizeChangedEvent)
            {
                output($"remote share size: width[{mediaChgEvent.Call.RemoteShareViewSize.Width}] height[{mediaChgEvent.Call.RemoteShareViewSize.Height}]");
                this.AspectShareScreenVideo = mediaChgEvent.Call.RemoteShareViewSize.Width / (double)mediaChgEvent.Call.RemoteShareViewSize.Height;
            }
            else if (mediaChgEvent is RemoteSendingVideoEvent)
            {
                this.curCallView?.RefreshRemoteViews();

                var remoteSendingVideoEvent = mediaChgEvent as RemoteSendingVideoEvent;
                if (remoteSendingVideoEvent.IsSending)
                {
                    output("remote unmute video");
                }
                else
                {
                    output("remote mute video");
                }
            }
            else if (mediaChgEvent is RemoteSendingAudioEvent)
            {
                var remoteSendingAudioEvent = mediaChgEvent as RemoteSendingAudioEvent;
                if (remoteSendingAudioEvent.IsSending)
                {
                    output("remote unmute audio");
                }
                else
                {
                    output("remote mute audio");
                }
            }
            else if (mediaChgEvent is RemoteSendingShareEvent)
            {
                this.curCallView?.RefreshShareViews();

                var remoteSendingShareEvent = mediaChgEvent as RemoteSendingShareEvent;
                if (remoteSendingShareEvent.IsSending)
                {
                    output("remote start share");
                    curCallView.SwitchShareViewWithRemoteView(true);
                }
                else
                {
                    output("remote stop share");
                    curCallView.SwitchShareViewWithRemoteView(false);
                }
            }
            else if (mediaChgEvent is SendingVideoEvent)
            {
                this.curCallView?.RefreshLocalViews();

                var sendingVideoEvent = mediaChgEvent as SendingVideoEvent;
                if (sendingVideoEvent.IsSending)
                {
                    output("local unmute video");
                }
                else
                {
                    output("local mute video");
                }
            }
            else if (mediaChgEvent is SendingAudioEvent)
            {
                var sendingAudioEvent = mediaChgEvent as SendingAudioEvent;
                if (sendingAudioEvent.IsSending)
                {
                    output("local unmute audio");
                }
                else
                {
                    output("local mute audio");
                }
            }
            else if (mediaChgEvent is SendingShareEvent)
            {
                var sendingShareEvent = mediaChgEvent as SendingShareEvent;
                if (sendingShareEvent.IsSending)
                {
                    output("local is sending share");
                }
                else
                {
                    output("local share stoped.");
                }
            }
            else if (mediaChgEvent is ReceivingVideoEvent)
            {
                this.curCallView?.RefreshRemoteViews();

                var receivingVideoEvent = mediaChgEvent as ReceivingVideoEvent;
                if (receivingVideoEvent.IsReceiving)
                {
                    output("local restore remote video");
                }
                else
                {
                    output("local close remote video");
                }
            }
            else if (mediaChgEvent is ReceivingAudioEvent)
            {
                var receivingAudioEvent = mediaChgEvent as ReceivingAudioEvent;
                if (receivingAudioEvent.IsReceiving)
                {
                    output("local restore remote audio");
                }
                else
                {
                    output("local close remote audio");
                }
            }
            else if (mediaChgEvent is ReceivingShareEvent)
            {
                this.curCallView?.RefreshShareViews();

                var receivingShareEvent = mediaChgEvent as ReceivingShareEvent;
                if (receivingShareEvent.IsReceiving)
                {
                    output("local restore remote share");
                }
                else
                {
                    output("local close remote share");
                }
            }
            else if (mediaChgEvent is CameraSwitchedEvent)
            {
                var cameraSwitchedEvent = mediaChgEvent as CameraSwitchedEvent;
                output($"switch camera to {cameraSwitchedEvent.Camera.Name}");
            }
            else if (mediaChgEvent is SpeakerSwitchedEvent)
            {
                var speakerSwitchedEvent = mediaChgEvent as SpeakerSwitchedEvent;
                output($"switch camera to {speakerSwitchedEvent.Speaker.Name}");
            }
            else
            {
            }
        }
        private void CurrentCall_onMediaChanged(MediaChangedEvent mediaChgEvent)
        {
            RefreshAudioVideoCtrlView();

            if (mediaChgEvent is LocalVideoViewSizeChangedEvent)
            {
                Output($"remote video size: width[{mediaChgEvent.Call.LocalVideoViewSize.Width}] height[{mediaChgEvent.Call.LocalVideoViewSize.Height}]");
                this.AspectRatioLocalVedio = mediaChgEvent.Call.LocalVideoViewSize.Width / (double)mediaChgEvent.Call.LocalVideoViewSize.Height;
            }
            else if (mediaChgEvent is RemoteVideoViewSizeChangedEvent)
            {
                Output($"remote video size: width[{mediaChgEvent.Call.RemoteVideoViewSize.Width}] height[{mediaChgEvent.Call.RemoteVideoViewSize.Height}]");
                this.AspectRatioRemoteVedio = mediaChgEvent.Call.RemoteVideoViewSize.Width / (double)mediaChgEvent.Call.RemoteVideoViewSize.Height;
            }
            else if (mediaChgEvent is RemoteShareViewSizeChangedEvent)
            {
                Output($"remote share size: width[{mediaChgEvent.Call.RemoteShareViewSize.Width}] height[{mediaChgEvent.Call.RemoteShareViewSize.Height}]");
                this.AspectShareScreenVideo = mediaChgEvent.Call.RemoteShareViewSize.Width / (double)mediaChgEvent.Call.RemoteShareViewSize.Height;
            }
            else if (mediaChgEvent is RemoteSendingVideoEvent remoteSendingVideoEvent)
            {
                this.curCallView?.RefreshRemoteViews();
                Output($"RemoteSendingVideoEvent: IsSending[{remoteSendingVideoEvent.IsSending}]");
                if (remoteSendingVideoEvent.IsSending)
                {
                    UpdateRemoteVideoView();
                }
                else
                {
                    //show avatar or spinning circle
                    if (CurrentCall.ActiveSpeaker != null)
                    {
                        Application.Current.Dispatcher.Invoke(() =>
                        {
                            ShowAvartar(curCallView.RemoteViewHandle, CurrentCall?.ActiveSpeaker?.PersonId);
                        });
                    }
                }
            }
            else if (mediaChgEvent is RemoteSendingAudioEvent remoteSendingAudioEvent)
            {
                Output($"RemoteSendingAudioEvent: IsSending[{remoteSendingAudioEvent.IsSending}]");
            }
            else if (mediaChgEvent is RemoteSendingShareEvent remoteSendingShareEvent)
            {
                this.curCallView?.RefreshShareViews();
                Output($"RemoteSendingShareEvent: IsSending[{remoteSendingShareEvent.IsSending}]");
                curCallView.SwitchShareViewWithRemoteView(remoteSendingShareEvent.IsSending);
            }
            else if (mediaChgEvent is SendingVideoEvent sendingVideoEvent)
            {
                this.curCallView?.RefreshLocalViews();
                Output($"SendingVideoEvent: IsSending[{sendingVideoEvent.IsSending}]");
                if (sendingVideoEvent.IsSending)
                {
                    UpdateLocalVideoView();
                }
            }
            else if (mediaChgEvent is SendingAudioEvent sendingAudioEvent)
            {
                Output($"SendingAudioEvent: IsSending[{sendingAudioEvent.IsSending}]");
            }
            else if (mediaChgEvent is SendingShareEvent sendingShareEvent)
            {
                Output($"SendingShareEvent: IsSending[{sendingShareEvent.IsSending}]");
            }
            else if (mediaChgEvent is ReceivingVideoEvent receivingVideoEvent)
            {
                this.curCallView?.RefreshRemoteViews();
                Output($"ReceivingVideoEvent: IsReceiving[{receivingVideoEvent.IsReceiving}]");
            }
            else if (mediaChgEvent is ReceivingAudioEvent receivingAudioEvent)
            {
                Output($"ReceivingAudioEvent: IsReceiving[{receivingAudioEvent.IsReceiving}]");
            }
            else if (mediaChgEvent is ReceivingShareEvent receivingShareEvent)
            {
                this.curCallView?.RefreshShareViews();
                Output($"ReceivingShareEvent: IsReceiving[{receivingShareEvent.IsReceiving}]");
            }
            else if (mediaChgEvent is CameraSwitchedEvent cameraSwitchedEvent)
            {
                Output($"CameraSwitchedEvent: switch camera to {cameraSwitchedEvent.Camera.Name}");
            }
            else if (mediaChgEvent is SpeakerSwitchedEvent speakerSwitchedEvent)
            {
                Output($"SpeakerSwitchedEvent: switch speaker to {speakerSwitchedEvent.Speaker.Name}");
            }
            else if (mediaChgEvent is ActiveSpeakerChangedEvent activeSpeakerChanged)
            {
                if (activeSpeakerChanged.ToPerson != null)
                {
                    IfShowRemoteView = true;
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        ShowAvartar(curCallView.RemoteViewHandle, activeSpeakerChanged.ToPerson.PersonId);
                    });
                    ApplicationController.Instance.CurWebexManager.CurWebex.People.Get(activeSpeakerChanged.ToPerson.PersonId, r =>
                    {
                        if (r.IsSuccess)
                        {
                            ActiveSpeaker = r.Data.DisplayName;
                        }
                    });
                    Output($"ActiveSpeakerChangedEvent: active speaker is changed to {activeSpeakerChanged?.ToPerson?.Email}");
                }
                else
                {
                    IfShowRemoteView = false;
                    ActiveSpeaker    = null;
                    Output($"ActiveSpeakerChangedEvent: active speaker is changed to null");
                }
            }
        }