예제 #1
0
 internal MediaOutput(GroupCall groupCall, GroupCall room, TeamsMeeting teamsMeeting, RtmpStream rtmp, SrtStream srt, MediaOutputType?kind)
 {
     GroupCall    = groupCall;
     Room         = room;
     TeamsMeeting = teamsMeeting;
     Rtmp         = rtmp;
     Srt          = srt;
     Kind         = kind;
 }
예제 #2
0
        public void IsValid_NoParticipants_ReturnFalse()
        {
            var groupCall = new GroupCall();

            groupCall.TenantId = _tenantId;

            var result = groupCall.IsValid();

            Assert.False(result);
        }
예제 #3
0
        public void IsValid_NoTeantnId_ReturnFalse()
        {
            var groupCall = new GroupCall();

            groupCall.ParticipantEmails = _participants;

            var result = groupCall.IsValid();

            Assert.False(result);
        }
예제 #4
0
        public void IsValid_ValidInput_ReturnTrue()
        {
            var groupCall = new GroupCall();

            groupCall.TenantId          = _tenantId;
            groupCall.ParticipantEmails = _participants;

            var result = groupCall.IsValid();

            Assert.True(result);
        }
예제 #5
0
        private Mock <HttpRequest> UnexpecterdHttpRequest()
        {
            // Empty request
            var    groupCall      = new GroupCall();
            string requestContent = JsonConvert.SerializeObject(groupCall);

            var httpRequestMock = new Mock <HttpRequest>();

            httpRequestMock.Setup(h => h.Body).Returns(new MemoryStream(Encoding.UTF8.GetBytes(requestContent)));

            return(httpRequestMock);
        }
예제 #6
0
        private Mock <HttpRequest> CreateHttpRequest()
        {
            var groupCall = new GroupCall();

            groupCall.TenantId          = "tenantId";
            groupCall.ParticipantEmails = new string[] { "*****@*****.**", "*****@*****.**" };
            string requestContent = JsonConvert.SerializeObject(groupCall);

            var httpRequestMock = new Mock <HttpRequest>();

            httpRequestMock.Setup(h => h.Body).Returns(new MemoryStream(Encoding.UTF8.GetBytes(requestContent)));

            return(httpRequestMock);
        }
예제 #7
0
        public bool UpdateGroupCall(Chat chat, GroupCall call)
        {
            var visible = true;
            var channel = call?.IsRtmpStream is true || (chat.Type is ChatTypeSupergroup super && super.IsChannel);

            //if (chat.VideoChat.GroupCallId != call?.Id || !chat.VideoChat.HasParticipants || call == null || call.IsJoined)
            //{
            //    ShowHide(false);
            //    visible = false;
            //}
            //else
            if (call != null && chat.VideoChat.GroupCallId == call.Id && ((chat.VideoChat.HasParticipants && !(call.IsJoined || call.NeedRejoin)) || call.ScheduledStartDate > 0))
            {
                ShowHide(true);

                TitleLabel.Text   = call.ScheduledStartDate > 0 && call.Title.Length > 0 ? call.Title : channel ? Strings.Resources.VoipChannelVoiceChat : Strings.Resources.VoipGroupVoiceChat;
                ServiceLabel.Text = call.ParticipantCount > 0 ? Locale.Declension("Participants", call.ParticipantCount) : Strings.Resources.MembersTalkingNobody;

                if (call.ScheduledStartDate != 0)
                {
                    var date     = Converters.Converter.DateTime(call.ScheduledStartDate);
                    var duration = date - DateTime.Now;

                    if (duration.TotalDays < 1)
                    {
                        _scheduledTimer.Start();
                    }
                    else
                    {
                        _scheduledTimer.Stop();
                    }

                    TitleLabel.Text = call.Title.Length > 0 ? call.Title : channel ? Strings.Resources.VoipChannelScheduledVoiceChat : Strings.Resources.VoipGroupScheduledVoiceChat;

                    JoinButton.Background = BootStrapper.Current.Resources["VideoChatPurpleBrush"] as Brush;
                    JoinButton.Content    = call.GetStartsIn();
                }
                else
                {
                    _scheduledTimer.Stop();

                    TitleLabel.Text = channel ? Strings.Resources.VoipChannelVoiceChat : Strings.Resources.VoipGroupVoiceChat;

                    JoinButton.Background = BootStrapper.Current.Resources["StartButtonBackground"] as Brush;
                    JoinButton.Content    = Strings.Resources.VoipChatJoin;
                }

                if (call.HasHiddenListeners)
                {
                    RecentUsers.Items.Clear();
                }
                else
                {
                    if (RecentUsers.Items.Count > 0 && _call?.Id == call.Id)
                    {
                        RecentUsers.Items.ReplaceDiff(call.RecentSpeakers.Select(x => x.ParticipantId));
                    }
                    else
                    {
                        RecentUsers.Items.Clear();
                        RecentUsers.Items.AddRange(call.RecentSpeakers.Select(x => x.ParticipantId));
                    }
                }
            }
            else
            {
                ShowHide(false);
                visible = false;
            }

            _call = call;
            return(visible);
        }
예제 #8
0
 public UpdateCallDialog(GroupCall call)
 {
     GroupCall = call;
 }
예제 #9
0
        public bool UpdateGroupCall(Chat chat, GroupCall call)
        {
            var visible = true;

            //if (chat.VoiceChat.GroupCallId != call?.Id || !chat.VoiceChat.HasParticipants || call == null || call.IsJoined)
            //{
            //    ShowHide(false);
            //    visible = false;
            //}
            //else
            if (call != null && chat.VoiceChat.GroupCallId == call.Id && ((chat.VoiceChat.HasParticipants && !(call.IsJoined || call.NeedRejoin)) || call.ScheduledStartDate > 0))
            {
                ShowHide(true);

                TitleLabel.Text   = call.ScheduledStartDate > 0 && call.Title.Length > 0 ? call.Title : Strings.Resources.VoipGroupVoiceChat;
                ServiceLabel.Text = call.ParticipantCount > 0 ? Locale.Declension("Participants", call.ParticipantCount) : Strings.Resources.MembersTalkingNobody;

                if (call.ScheduledStartDate != 0)
                {
                    var date     = Converters.Converter.DateTime(call.ScheduledStartDate);
                    var duration = date - DateTime.Now;

                    if (duration.TotalDays < 1)
                    {
                        _scheduledTimer.Start();
                    }
                    else
                    {
                        _scheduledTimer.Stop();
                    }

                    TitleLabel.Text = call.Title.Length > 0 ? call.Title : Strings.Resources.VoipGroupScheduledVoiceChat;

                    JoinButton.Background = BootStrapper.Current.Resources["VoiceChatPurpleBrush"] as Brush;
                    JoinButton.Content    = call.GetStartsIn();
                }
                else
                {
                    _scheduledTimer.Stop();

                    TitleLabel.Text = Strings.Resources.VoipGroupVoiceChat;

                    JoinButton.Background = BootStrapper.Current.Resources["StartButtonBackground"] as Brush;
                    JoinButton.Content    = Strings.Resources.VoipChatJoin;
                }

                var destination = RecentUsers.Items;
                var origin      = call.RecentSpeakers;

                if (_call?.Id == call.Id)
                {
                    for (int i = 0; i < origin.Count; i++)
                    {
                        var item  = origin[i];
                        var index = -1;

                        for (int j = 0; j < destination.Count; j++)
                        {
                            if (destination[j].IsEqual(item.ParticipantId))
                            {
                                index = j;
                                break;
                            }
                        }

                        if (index > -1 && index != i)
                        {
                            destination.Move(index, Math.Min(i, destination.Count));
                        }
                        else if (index == -1)
                        {
                            destination.Insert(Math.Min(i, destination.Count), item.ParticipantId);
                        }
                    }

                    for (int i = 0; i < destination.Count; i++)
                    {
                        var item  = destination[i];
                        var index = -1;

                        for (int j = 0; j < origin.Count; j++)
                        {
                            if (origin[j].ParticipantId.IsEqual(item))
                            {
                                index = j;
                                break;
                            }
                        }

                        if (index == -1)
                        {
                            destination.Remove(item);
                            i--;
                        }
                    }
                }
                else
                {
                    RecentUsers.Items.ReplaceWith(origin.Select(x => x.ParticipantId));
                }
            }
            else
            {
                ShowHide(false);
                visible = false;
            }

            _call = call;
            return(visible);
        }