feat: add mobile control messengers for participant audio and video mute functionality

This commit is contained in:
Neil Dorin 2026-06-24 22:28:40 -06:00
parent f4fe8eff90
commit f7c3ed4b8b
4 changed files with 109 additions and 1 deletions

View file

@ -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);
});
}
}
}

View file

@ -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);
});
}
}
}