feat(webrtc): add admin option to mute other participants

This commit is contained in:
2026-07-06 13:04:39 +00:00
parent 9aeedb1a53
commit ed408c4044
3 changed files with 120 additions and 13 deletions
+27
View File
@@ -99,6 +99,33 @@ func (c *Client) ListParticipants(roomName string) ([]*livekit.ParticipantInfo,
return resp.Participants, nil
}
func (c *Client) MuteParticipant(roomName string, identity string) error {
if c == nil {
return fmt.Errorf("voice client not configured")
}
participant, err := c.roomClient.GetParticipant(context.Background(), &livekit.RoomParticipantIdentity{
Room: roomName,
Identity: identity,
})
if err != nil {
return fmt.Errorf("get participant: %w", err)
}
for _, track := range participant.Tracks {
_, err := c.roomClient.MutePublishedTrack(context.Background(), &livekit.MuteRoomTrackRequest{
Room: roomName,
Identity: identity,
TrackSid: track.Sid,
Muted: true,
})
if err != nil {
return fmt.Errorf("mute track %s: %w", track.Sid, err)
}
}
return nil
}
func boolPtr(b bool) *bool {
return &b
}