setInputSensitivity

View as Markdown

setInputSensitivity

  • setInputSensitivity(params): Promise<void>

Sets the input level at which the participant is identified as currently speaking.

Parameters

params
objectRequired

Object containing the parameters of the method.

memberId
string

ID of the member to affect.

value
numberDefaults to 30Required

Desired sensitivity from 0 (lowest sensitivity, essentially muted) to 100 (highest sensitivity).

Returns

Promise<void>

Example

In this example, we wait for a room to start and then set the input sensitivity for a member to 0. 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 the 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 // Setup listener for when a room is updated
15 roomsession.listen({
16 onMemberJoined: async (member) => {
17 console.log("Member joined", member.name);
18
19 // Update the input sensitivity for the member
20 await roomsession.setInputSensitivity({
21 value: 0,
22 memberId: member.id,
23 });
24 },
25 onMemberUpdated: async (member) => {
26 console.log(`Updated input sensitivity for ${member.name, member.inputSensitivity}`);
27 },
28 })
29 }
30});