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.
Type
Participant[]
localParticipant
the current participant
Type
LocalParticipant
participants
Map of all remote participants currently connected to the room.
state
Current connection state of the room.
Type
ConnectionState
Accessors
isRecording
if the current room has a participant with
recorder: true
in its JWT grantType
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 participantsnumPublishers
Returns the current number of publishers in the room.
Type
number
number of publisherssid
server assigned unique room id
Type
string
Methods
getParticipantByIdentity
retrieves a participant by identity
Signature
getParticipantByIdentity(identity: string)
Name | Type | Description |
---|---|---|
identity | string |
leave
Leaves the room.
Signature
leave()
Returns
void
prepareConnection
prepares the connection to the livekit server by sending a HEAD request in order to
- speed up DNS resolution
- 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)
Name | Type | Description |
---|---|---|
url | string |
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)
Name | Type | Description |
---|---|---|
kind | MediaDeviceKind | use videoinput for camera track,audioinput for microphone track, |
audiooutput to set speaker for all incoming audio tracks | ||
deviceId | string | |
exact | boolean |
Returns
Promise
<void
>