getLayouts

View as Markdown

getLayouts

  • getLayouts(): Promise<\{ layouts: string[] \}>

Returns a list of available layouts for the room. To set a room layout, use setLayout.

Returns

Promise<\{ layouts: string[] \}>

A promise that resolves to an object containing the list of available layouts for the room.

Example

In this example, we wait for a room to start and then get the available layouts for that room. 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 const layouts = await roomsession.getLayouts();
14 console.log("Layouts", layouts.layouts);
15 }
16})