Merge pull request #789 from PepperDash/hotfix/zoomroom-duplicate-participant-in-list

Hotfix/zoomroom duplicate participant in list
This commit is contained in:
Andrew Welker
2021-08-17 16:26:18 -06:00
committed by GitHub
2 changed files with 955 additions and 846 deletions

View File

@@ -1,100 +1,102 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
{ {
/// <summary> /// <summary>
/// Describes a device that has call participants /// Describes a device that has call participants
/// </summary> /// </summary>
public interface IHasParticipants public interface IHasParticipants
{ {
CodecParticipants Participants { get; } CodecParticipants Participants { get; }
} }
/// <summary> /// <summary>
/// Describes the ability to mute and unmute a participant's video in a meeting /// Describes the ability to mute and unmute a participant's video in a meeting
/// </summary> /// </summary>
public interface IHasParticipantVideoMute:IHasParticipants public interface IHasParticipantVideoMute : IHasParticipants
{ {
void MuteVideoForParticipant(int userId); void MuteVideoForParticipant(int userId);
void UnmuteVideoForParticipant(int userId); void UnmuteVideoForParticipant(int userId);
void ToggleVideoForParticipant(int userId); void ToggleVideoForParticipant(int userId);
} }
/// <summary> /// <summary>
/// Describes the ability to mute and unmute a participant's audio in a meeting /// Describes the ability to mute and unmute a participant's audio in a meeting
/// </summary> /// </summary>
public interface IHasParticipantAudioMute : IHasParticipantVideoMute public interface IHasParticipantAudioMute : IHasParticipantVideoMute
{ {
void MuteAudioForParticipant(int userId); void MuteAudioForParticipant(int userId);
void UnmuteAudioForParticipant(int userId); void UnmuteAudioForParticipant(int userId);
void ToggleAudioForParticipant(int userId); void ToggleAudioForParticipant(int userId);
} }
/// <summary> /// <summary>
/// Describes the ability to pin and unpin a participant in a meeting /// Describes the ability to pin and unpin a participant in a meeting
/// </summary> /// </summary>
public interface IHasParticipantPinUnpin : IHasParticipants public interface IHasParticipantPinUnpin : IHasParticipants
{ {
IntFeedback NumberOfScreensFeedback { get; } IntFeedback NumberOfScreensFeedback { get; }
int ScreenIndexToPinUserTo { get; } int ScreenIndexToPinUserTo { get; }
void PinParticipant(int userId, int screenIndex); void PinParticipant(int userId, int screenIndex);
void UnPinParticipant(int userId); void UnPinParticipant(int userId);
void ToggleParticipantPinState(int userId, int screenIndex); void ToggleParticipantPinState(int userId, int screenIndex);
} }
public class CodecParticipants public class CodecParticipants
{ {
private List<Participant> _currentParticipants; private List<Participant> _currentParticipants;
public List<Participant> CurrentParticipants {
get { return _currentParticipants; }
set
{
_currentParticipants = value;
OnParticipantsChanged();
}
}
public event EventHandler<EventArgs> ParticipantsListHasChanged; public List<Participant> CurrentParticipants
{
get { return _currentParticipants; }
set
{
_currentParticipants = value;
OnParticipantsChanged();
}
}
public CodecParticipants() public event EventHandler<EventArgs> ParticipantsListHasChanged;
{
_currentParticipants = new List<Participant>();
}
public void OnParticipantsChanged() public CodecParticipants()
{ {
var handler = ParticipantsListHasChanged; _currentParticipants = new List<Participant>();
}
if (handler == null) return; public void OnParticipantsChanged()
{
var handler = ParticipantsListHasChanged;
handler(this, new EventArgs()); if (handler == null) return;
}
}
/// <summary> handler(this, new EventArgs());
/// Represents a call participant }
/// </summary> }
public class Participant
{
public int UserId { get; set; }
public bool IsHost { 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() /// <summary>
{ /// Represents a call participant
// Initialize to -1 (no screen) /// </summary>
ScreenIndexIsPinnedToFb = -1; public class Participant
} {
} public int UserId { get; set; }
public bool IsHost { 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;
}
}
} }