atmoky Engage Server SDK is now available! Check out the documentation to learn more.
API Reference
Classes
Room

Room

Summary
A room is a communication channel participants can connect to and exchange audio and video.
Remarks
Rooms are created by the Space class when calling joinRoom. Rooms hold a list of participants that are currently connected, and can be used to publish audio and video. Rooms can also be used to send data packets to other participants.

Properties

activeSpeakers

List of participants that are actively speaking. When this changes a RoomEvent.ActiveSpeakersChanged event is fired.

localParticipant

the current participant

participants

Map of all remote participants currently connected to the room.
Remarks
The mapping is sid to RemoteParticipant.
Type
Map<string, RemoteParticipant>

state

Current connection state of the room.

Accessors

isRecording

if the current room has a participant with recorder: true in its JWT grant
Type
boolean

metadata

room metadata
Type
undefined | string

name

user assigned name, derived from JWT token
Type
string

numParticipants

Returns the current number of participants in the room.
Type
number number of participants

numPublishers

Returns the current number of publishers in the room.
Type
number number of publishers

sid

server assigned unique room id
Type
string

Methods

getParticipantByIdentity

retrieves a participant by identity
Signature
getParticipantByIdentity(identity: string)
NameTypeDescription
identitystring
Returns
undefined | Participant

leave

Leaves the room.
Signature
leave()
Returns
void

prepareConnection

prepares the connection to the livekit server by sending a HEAD request in order to
  1. speed up DNS resolution
  2. speed up TLS setup on the actual connection request throws an error if server is not reachable after the request timeout
Signature
prepareConnection(url: string)
NameTypeDescription
urlstring
Returns
Promise<void>

switchActiveDevice

Switches all active devices used in this room to the given device.
Note: setting AudioOutput is not supported on some browsers. See setSinkId (opens in a new tab)
Signature
switchActiveDevice(kind: MediaDeviceKind, deviceId: string, exact: boolean)
NameTypeDescription
kindMediaDeviceKinduse videoinput for camera track,
audioinput for microphone track,
audiooutput to set speaker for all incoming audio tracks
deviceIdstring
exactboolean
Returns
Promise<void>

atmoky Logo

© 2024 atmoky, GmbH.
All rights reserved.

We use cookies to measure and improve your browsing experience, and serve personalized ads or content.