using System; using System.Linq; using System.Collections.Generic; using PepperDash.Core; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces { /// /// Describes a device that has call participants /// public interface IHasParticipants { CodecParticipants Participants { get; } /// /// Removes the participant from the meeting /// /// void RemoveParticipant(int userId); /// /// Sets the participant as the new host /// /// void SetParticipantAsHost(int userId); /// /// Admits a participant from the waiting room /// /// void AdmitParticipantFromWaitingRoom(int userId); } /// /// Describes the ability to mute and unmute a participant's video in a meeting /// public interface IHasParticipantVideoMute : IHasParticipants { void MuteVideoForParticipant(int userId); void UnmuteVideoForParticipant(int userId); void ToggleVideoForParticipant(int userId); } /// /// Describes the ability to mute and unmute a participant's audio in a meeting /// public interface IHasParticipantAudioMute : IHasParticipantVideoMute { /// /// Mute audio of all participants /// void MuteAudioForAllParticipants(); void MuteAudioForParticipant(int userId); void UnmuteAudioForParticipant(int userId); void ToggleAudioForParticipant(int userId); } /// /// Describes the ability to pin and unpin a participant in a meeting /// public interface IHasParticipantPinUnpin : IHasParticipants { IntFeedback NumberOfScreensFeedback { get; } int ScreenIndexToPinUserTo { get; } void PinParticipant(int userId, int screenIndex); void UnPinParticipant(int userId); void ToggleParticipantPinState(int userId, int screenIndex); } public class CodecParticipants { private List _currentParticipants; public List CurrentParticipants { get { return _currentParticipants; } set { _currentParticipants = value; OnParticipantsChanged(); } } public Participant Host { get { return _currentParticipants.FirstOrDefault(p => p.IsHost); } } public event EventHandler ParticipantsListHasChanged; public CodecParticipants() { _currentParticipants = new List(); } public void OnParticipantsChanged() { var handler = ParticipantsListHasChanged; if (handler == null) return; handler(this, new EventArgs()); } } /// /// Represents a call participant /// public class Participant { public int UserId { get; set; } public bool IsHost { get; set; } public bool IsMyself { get; set; } public string Name { get; set; } public bool CanMuteVideo { get; set; } public bool CanUnmuteVideo { get; set; } public bool VideoMuteFb { get; set; } public bool AudioMuteFb { get; set; } public bool HandIsRaisedFb { get; set; } public bool IsPinnedFb { get; set; } public int ScreenIndexIsPinnedToFb { get; set; } public Participant() { // Initialize to -1 (no screen) ScreenIndexIsPinnedToFb = -1; } } }