예제 #1
0
        public Task PostPublish <T>(PublishContext <T> context) where T : class
        {
            if (context.Message is MediaStateChanged message && message.ConferenceId == _conferenceId)
            {
                State = ApplyUpdate(State, message.Payload);
            }

            return(Task.CompletedTask);
        }
예제 #2
0
        private static SfuConferenceInfo ApplyUpdate(SfuConferenceInfo current, SfuConferenceInfoUpdate update)
        {
            var newPermissions  = current.ParticipantPermissions.ToDictionary(x => x.Key, x => x.Value);
            var newParticipants = current.ParticipantToRoom.ToDictionary(x => x.Key, x => x.Value);

            foreach (var updatePermission in update.ParticipantPermissions)
            {
                newPermissions[updatePermission.Key] = updatePermission.Value;
            }

            foreach (var(participantId, roomId) in update.ParticipantToRoom)
            {
                newParticipants[participantId] = roomId;
            }

            foreach (var removedParticipantId in update.RemovedParticipants)
            {
                newPermissions.Remove(removedParticipantId);
                newParticipants.Remove(removedParticipantId);
            }

            return(new SfuConferenceInfo(newParticipants, newPermissions));
        }
예제 #3
0
 public SfuConferenceInfoEndpoint(SfuConferenceInfo state, string conferenceId)
 {
     _conferenceId = conferenceId;
     State         = state;
 }