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
|
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -8,61 +9,73 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the UserId
|
/// Gets or sets the UserId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("userId")]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsHost
|
/// Gets or sets the IsHost
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("isHost")]
|
||||||
public bool IsHost { get; set; }
|
public bool IsHost { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsCohost
|
/// Gets or sets the IsCohost
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("isCohost")]
|
||||||
public bool IsCohost { get; set; }
|
public bool IsCohost { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsMyself
|
/// Gets or sets the IsMyself
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("isMyself")]
|
||||||
public bool IsMyself { get; set; }
|
public bool IsMyself { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Name
|
/// Gets or sets the Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Email
|
/// Gets or sets the Email
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("email")]
|
||||||
public bool CanMuteVideo { get; set; }
|
public bool CanMuteVideo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CanUnmuteVideo
|
/// Gets or sets the CanUnmuteVideo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("canUnmuteVideo")]
|
||||||
public bool CanUnmuteVideo { get; set; }
|
public bool CanUnmuteVideo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the CanMuteAudio
|
/// Gets or sets the CanMuteAudio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool VideoMuteFb { get; set; }
|
[JsonProperty("canMuteAudio")]
|
||||||
|
public bool CanMuteAudio { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the AudioMuteFb
|
/// Gets or sets the AudioMuteFb
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("audioMuteFb")]
|
||||||
public bool AudioMuteFb { get; set; }
|
public bool AudioMuteFb { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the HandIsRaisedFb
|
/// Gets or sets the HandIsRaisedFb
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("handIsRaisedFb")]
|
||||||
public bool HandIsRaisedFb { get; set; }
|
public bool HandIsRaisedFb { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IsPinnedFb
|
/// Gets or sets the IsPinnedFb
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("isPinnedFb")]
|
||||||
public bool IsPinnedFb { get; set; }
|
public bool IsPinnedFb { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ScreenIndexIsPinnedToFb
|
/// Gets or sets the ScreenIndexIsPinnedToFb
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("screenIndexIsPinnedToFb")]
|
||||||
public int ScreenIndexIsPinnedToFb { get; set; }
|
public int ScreenIndexIsPinnedToFb { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <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, mp, ck) => new IHasFarEndContentStatusMessenger(
|
||||||
$"{d.Key}-farEndContent-{ck}", mp, d)
|
$"{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(
|
new MessengerFactoryEntry(
|
||||||
typeof(IHasMeetingInfo),
|
typeof(IHasMeetingInfo),
|
||||||
(d, mp, ck) => new IHasMeetingInfoMessenger(
|
(d, mp, ck) => new IHasMeetingInfoMessenger(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue