mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
feat: add mobile control messengers for participant audio and video mute functionality
This commit is contained in:
parent
f4fe8eff90
commit
f7c3ed4b8b
4 changed files with 109 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using Newtonsoft.Json;
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -8,61 +9,73 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
|||
/// <summary>
|
||||
/// Gets or sets the UserId
|
||||
/// </summary>
|
||||
[JsonProperty("userId")]
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsHost
|
||||
/// </summary>
|
||||
[JsonProperty("isHost")]
|
||||
public bool IsHost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsCohost
|
||||
/// </summary>
|
||||
[JsonProperty("isCohost")]
|
||||
public bool IsCohost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsMyself
|
||||
/// </summary>
|
||||
[JsonProperty("isMyself")]
|
||||
public bool IsMyself { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Email
|
||||
/// </summary>
|
||||
[JsonProperty("email")]
|
||||
public bool CanMuteVideo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CanUnmuteVideo
|
||||
/// </summary>
|
||||
[JsonProperty("canUnmuteVideo")]
|
||||
public bool CanUnmuteVideo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CanMuteAudio
|
||||
/// </summary>
|
||||
public bool VideoMuteFb { get; set; }
|
||||
[JsonProperty("canMuteAudio")]
|
||||
public bool CanMuteAudio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AudioMuteFb
|
||||
/// </summary>
|
||||
[JsonProperty("audioMuteFb")]
|
||||
public bool AudioMuteFb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the HandIsRaisedFb
|
||||
/// </summary>
|
||||
[JsonProperty("handIsRaisedFb")]
|
||||
public bool HandIsRaisedFb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsPinnedFb
|
||||
/// </summary>
|
||||
[JsonProperty("isPinnedFb")]
|
||||
public bool IsPinnedFb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ScreenIndexIsPinnedToFb
|
||||
/// </summary>
|
||||
[JsonProperty("screenIndexIsPinnedToFb")]
|
||||
public int ScreenIndexIsPinnedToFb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.AppServer;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Mobile Control messenger for <see cref="IHasParticipantAudioMute"/>:
|
||||
/// mute-all and per-participant audio/video mute toggles. Action-only (no status of its own).
|
||||
/// </summary>
|
||||
public class IHasParticipantAudioMuteMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasParticipantAudioMute _codec;
|
||||
|
||||
public IHasParticipantAudioMuteMessenger(string key, string messagePath, EssentialsDevice device)
|
||||
: base(key, messagePath, device)
|
||||
{
|
||||
_codec = device as IHasParticipantAudioMute ?? throw new ArgumentNullException(nameof(device));
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/muteAllParticipants", (id, content) => _codec.MuteAudioForAllParticipants());
|
||||
AddAction("/toggleParticipantAudioMute", (id, content) =>
|
||||
{
|
||||
var i = content?.ToObject<MobileControlSimpleContent<int>>();
|
||||
if (i != null) _codec.ToggleAudioForParticipant(i.Value);
|
||||
});
|
||||
AddAction("/toggleParticipantVideoMute", (id, content) =>
|
||||
{
|
||||
var i = content?.ToObject<MobileControlSimpleContent<int>>();
|
||||
if (i != null) _codec.ToggleVideoForParticipant(i.Value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.AppServer;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
/// <summary>
|
||||
/// Mobile Control messenger for <see cref="IHasParticipantVideoMute"/>:
|
||||
/// per-participant video mute/unmute/toggle. Action-only (no status of its own).
|
||||
/// </summary>
|
||||
public class IHasParticipantVideoMuteMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasParticipantVideoMute _codec;
|
||||
|
||||
public IHasParticipantVideoMuteMessenger(string key, string messagePath, EssentialsDevice device)
|
||||
: base(key, messagePath, device)
|
||||
{
|
||||
_codec = device as IHasParticipantVideoMute ?? throw new ArgumentNullException(nameof(device));
|
||||
}
|
||||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/muteVideoForParticipant", (id, content) =>
|
||||
{
|
||||
var i = content?.ToObject<MobileControlSimpleContent<int>>();
|
||||
if (i != null) _codec.MuteVideoForParticipant(i.Value);
|
||||
});
|
||||
AddAction("/unmuteVideoForParticipant", (id, content) =>
|
||||
{
|
||||
var i = content?.ToObject<MobileControlSimpleContent<int>>();
|
||||
if (i != null) _codec.UnmuteVideoForParticipant(i.Value);
|
||||
});
|
||||
AddAction("/toggleParticipantVideoMute", (id, content) =>
|
||||
{
|
||||
var i = content?.ToObject<MobileControlSimpleContent<int>>();
|
||||
if (i != null) _codec.ToggleVideoForParticipant(i.Value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -236,6 +236,17 @@ namespace PepperDash.Essentials
|
|||
(d, mp, ck) => new IHasFarEndContentStatusMessenger(
|
||||
$"{d.Key}-farEndContent-{ck}", mp, d)
|
||||
),
|
||||
new MessengerFactoryEntry(
|
||||
typeof(IHasParticipantAudioMute),
|
||||
(d, mp, ck) => new IHasParticipantAudioMuteMessenger(
|
||||
$"{d.Key}-participantAudioMute-{ck}", mp, d)
|
||||
),
|
||||
new MessengerFactoryEntry(
|
||||
typeof(IHasParticipantVideoMute),
|
||||
(d, mp, ck) => new IHasParticipantVideoMuteMessenger(
|
||||
$"{d.Key}-participantVideoMute-{ck}", mp, d),
|
||||
predicate: d => d is IHasParticipantVideoMute && !(d is IHasParticipantAudioMute)
|
||||
),
|
||||
new MessengerFactoryEntry(
|
||||
typeof(IHasMeetingInfo),
|
||||
(d, mp, ck) => new IHasMeetingInfoMessenger(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue