videoUnmute

View as Markdown

videoUnmute

  • videoUnmute(params): Promise<void>

Unmutes the video of a given member if it had been previously muted. Participants will start seeing the video stream again.

Parameters

params
object

Object containing the parameters of the method.

memberId
string

ID of the member to unmute.

Returns

Promise<void>

Example

In this example, we wait for a room to start and then wait for a second member to join the room. When a second member joins the room, we mute the video of that member. After 5 seconds, we unmute the video of that member. This example assumes that there is a RoomSession already active and that members are joining the room.

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 onRoomStarted: async (roomSession) => {
12 console.log("Room started", roomSession.displayName);
13
14 await roomSession.listen({
15 onMemberJoined: (member) => {
16 console.log("Member joined", member.name);
17
18 // Video mute the member
19
20 roomSession.videoMute({
21 memberId: member.id,
22 })
23
24 setTimeout(() => {
25 console.log("Unmuting video for member", member.name)
26 // Video unmute the member
27 roomSession.videoUnmute({
28 memberId: member.id,
29 })
30 }, 5000)
31 },
32 onMemberUpdated: (member) => {
33 console.log("Member mute status updated", member.name, member.v);
34 },
35 });
36 }
37});