示例#1
0
        private void OnVoipStateUpdate(VoipState voipState)
        {
            RunOnUiThread(async () =>
            {
                _currentVoipState = voipState.State;

                switch (voipState.State)
                {
                    case VoipStateEnum.LocalRinging:
                        await PlaySound(true);
                        ShowAsParallel = false;
                        UpdateSelection();
                        break;
                    case VoipStateEnum.RemoteRinging:
                        await PlaySound(false);
                        ShowAsParallel = false;
                        UpdateSelection();
                        break;
                    case VoipStateEnum.Idle:
                        await StopSound();
                        ShowAsParallel = LayoutService.Instance.LayoutType == LayoutType.Parallel;
                        UpdateSelection();
                        break;
                    case VoipStateEnum.EstablishOutgoing:
                    case VoipStateEnum.EstablishIncoming:
                        await StopSound();
                        break;
                    case VoipStateEnum.HangingUp:
                    case VoipStateEnum.ActiveCall:
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            });
        }
示例#2
0
 public void OnVoipState(VoipState voipState)
 {
     if (_foregroundChannel == null)
     {
         _foregroundChannel = _container.Resolve<IForegroundChannel>();
     }
     _foregroundChannel.OnVoipState(voipState);
 }
 private void OnVoipStateUpdate(VoipState voipState)
 {
     switch (voipState.State)
     {
         case VoipStateEnum.Idle:
             CallState = CallState.Idle;
             IsOtherConversationInCallMode = false;
             LocalSwapChainPanelHandle = 0;
             RemoteSwapChainPanelHandle = 0;
             break;
         case VoipStateEnum.LocalRinging:
             if (voipState.PeerId == UserId)
             {
                 CallState = CallState.LocalRinging;
                 UnMuteCommandExecute(); //Start new calls with mic enabled
                 IsVideoEnabled = voipState.IsVideoEnabled;
                 IsAudioOnlyCall = !voipState.IsVideoEnabled;
                 LocalNativeVideoSize = new Size(0, 0);
                 RemoteNativeVideoSize = new Size(0, 0);
                 LocalFrameRate = "N/A";
                 RemoteFrameRate = "N/A";
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.RemoteRinging:
             if (voipState.PeerId == UserId)
             {
                 CallState = CallState.RemoteRinging;
                 UnMuteCommandExecute(); //Start new calls with mic enabled
                 IsVideoEnabled = voipState.IsVideoEnabled;
                 LocalNativeVideoSize = new Size(0, 0);
                 RemoteNativeVideoSize = new Size(0, 0);
                 LocalFrameRate = "N/A";
                 RemoteFrameRate = "N/A";
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.EstablishOutgoing:
             if (voipState.PeerId == UserId)
             {
                 CallState = CallState.Connected;
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.EstablishIncoming:
             if (voipState.PeerId == UserId)
             {
                 CallState = CallState.Connected;
                 IsVideoEnabled = voipState.IsVideoEnabled;
                 IsAudioOnlyCall = !voipState.IsVideoEnabled;
                 IsSelfVideoAvailable = IsVideoEnabled;
                 IsPeerVideoAvailable = IsVideoEnabled;
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.HangingUp:
             if (voipState.PeerId == UserId)
             {
                 CallState = CallState.Connected;
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.ActiveCall:
             if (voipState.PeerId == UserId)
             {
                 CallState = CallState.Connected;
                 IsSelfVideoAvailable = IsVideoEnabled;
                 IsPeerVideoAvailable = voipState.IsVideoEnabled;
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
 private void OnVoipStateUpdate(VoipState voipState)
 {
     switch (voipState.State)
     {
         case VoipStateEnum.Idle:
             IsInCallMode = false;
             IsLocalRinging = false;
             IsRemoteRinging = false;
             IsCallConnected = false;
             IsOtherConversationInCallMode = false;
             LocalSwapChainPanelHandle = 0;
             RemoteSwapChainPanelHandle = 0;
             StopSound();
             break;
         case VoipStateEnum.LocalRinging:
             if (voipState.PeerId == UserId)
             {
                 IsInCallMode = true;
                 IsLocalRinging = true;
                 IsRemoteRinging = false;
                 IsCallConnected = false;
                 IsMicEnabled = true; //Start new calls with mic enabled
                 IsVideoEnabled = voipState.IsVideoEnabled;
                 PlaySound(isIncomingCall: true);
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.RemoteRinging:
             if (voipState.PeerId == UserId)
             {
                 IsInCallMode = true;
                 IsLocalRinging = false;
                 IsRemoteRinging = true;
                 IsCallConnected = false;
                 IsMicEnabled = true; //Start new calls with mic enabled
                 IsVideoEnabled = voipState.IsVideoEnabled;
                 PlaySound(isIncomingCall: false);
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.EstablishOutgoing:
             if (voipState.PeerId == UserId)
             {
                 IsInCallMode = true;
                 IsLocalRinging = false;
                 IsRemoteRinging = false;
                 IsCallConnected = true;
                 StopSound();
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.EstablishIncoming:
             if (voipState.PeerId == UserId)
             {
                 IsInCallMode = true;
                 IsLocalRinging = false;
                 IsRemoteRinging = false;
                 IsCallConnected = true;
                 IsSelfVideoAvailable = IsVideoEnabled;
                 IsPeerVideoAvailable = voipState.IsVideoEnabled;
                 StopSound();
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.HangingUp:
             if (voipState.PeerId == UserId)
             {
                 IsInCallMode = true;
                 IsLocalRinging = false;
                 IsRemoteRinging = false;
                 IsCallConnected = true;
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         case VoipStateEnum.ActiveCall:
             if (voipState.PeerId == UserId)
             {
                 IsInCallMode = true;
                 IsLocalRinging = false;
                 IsRemoteRinging = false;
                 IsCallConnected = true;
                 IsSelfVideoAvailable = IsVideoEnabled;
                 IsPeerVideoAvailable = voipState.IsVideoEnabled;
             }
             else
             {
                 IsOtherConversationInCallMode = true;
             }
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
 public void OnVoipState(VoipState state)
 {
     RunOnUiThread(() => OnVoipStateUpdate?.Invoke(state));
 }
示例#6
0
 public void OnVoipState(VoipState voipState)
 {
     ForegroundClient.OnVoipState(voipState);
 }