audioMute

View as Markdown

audioMute

  • audioMute(params): Promise<void>

Mutes the audio of a given member for all other participants.

Parameters

params
object

Object containing the parameters of the method.

memberId
string

ID of the member to mute.

Returns

Promise<void>

Example

In this example, we mute the audio of a member as soon as they join the room. This example assumes that there is a RoomSession already active.

1import { SignalWire } from "@signalwire/realtime-api";
2
3// Initialize the SignalWire client
4const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
5
6// Access the video client from the main client
7const videoClient = client.video;
8
9// Setup listener for when a room starts
10await videoClient.listen({
11
12 onRoomStarted: async (roomSession) => {
13 console.log("Room started", roomSession.displayName);
14 await roomSession.listen({
15 // Listen for when a member joins the room
16 onMemberJoined: async (member) => {
17 // Mute member's audio
18 console.log(`Muting ${member.id}'s audio`);
19 await roomSession.audioMute({ memberId: member.id });
20 }
21 });
22 },
23 onRoomEnded: async (roomSession) => {
24 console.log("Room ended", roomSession.displayName);
25 }
26});