setOutputVolume

View as Markdown

setOutputVolume

  • setOutputVolume(params): Promise<void>

Sets the output volume for the member (e.g., the speaker output level).

Parameters

params
objectRequired

Object containing the parameters of the method.

memberId
string

ID of the member to affect.

volume
numberDefaults to 0Required

Desired volume. Values range from -50 to 50.

Returns

Promise<void>

Example

In this example, we wait for a room to start and then wait for a member to join the room. When a member joins the room, we set the output volume for that member to -50. 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
13 console.log("Room started", roomsession.displayName);
14
15 roomsession.listen({
16 onMemberJoined: async (member) => {
17 console.log("Member joined", member.displayName);
18 // set output volume to -50dB
19 console.log("Setting output volume to -50dB for", member.name);
20 await roomsession.setOutputVolume({
21 volume: -50,
22 memberId: member.id
23 });
24 },
25 onMemberUpdated: async (member) => {
26 console.log(`${member.name} output volume is now ${member.outputVolume}`);
27 },
28 })
29 }
30});