undeaf

View as Markdown

undeaf

  • undeaf(params): Promise<void>

Unmutes the incoming audio for a given member. The affected participant will start hearing audio from the other participants again.

Note that in addition to allowing a participants to hear the others, this will also automatically unmute the microphone of the target participant. If you want, you can then manually mute it by calling audioMute.

Parameters

params
objectRequired

Object containing the parameters of the method.

memberId
string

ID of the member to affect.

Returns

Promise<void>

Example

In this example, we mute a member when they join the room, and then unmute them after 5 seconds. This example assumes that there is a RoomSession already active and users are joining it.

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 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 console.log("Member joined", member.name);
18 // Deafen the member
19 console.log("Deafing member", member.name);
20 await roomSession.deaf({ memberId: member.id });
21
22 // Undeafen the member after 5 seconds
23 setTimeout(async () => {
24 console.log("Undeafing member", member.name);
25 await roomSession.undeaf({ memberId: member.id });
26 }, 5000);
27 }
28 });
29 },
30 onRoomEnded: async (roomSession) => {
31 console.log("Room ended", roomSession.displayName);
32 }
33});