Options
All
  • Public
  • Public/Protected
  • All
Menu

In LiveKit, a room is the logical grouping for a list of participants. Participants in a room can publish tracks, and subscribe to others' tracks.

a Room fires RoomEvents.

Hierarchy

  • TypedEventEmitter<RoomEventCallbacks, this>
    • Room

Index

Constructors

constructor

  • Creates a new Room, the primary construct for a LiveKit session.

    Parameters

    Returns Room

Properties

activeSpeakers

activeSpeakers: Participant[] = []

list of participants that are actively speaking. when this changes a RoomEvent.ActiveSpeakersChanged event is fired

localParticipant

localParticipant: LocalParticipant

the current participant

metadata

metadata: undefined | string = ...

room metadata

name

name: string = ''

user assigned name, derived from JWT token

options

options: RoomOptions

options of room

participants

participants: Map<string, RemoteParticipant>

map of sid: RemoteParticipant

sid

sid: string = ''

server assigned unique room id

state

state: RoomState = ...

Accessors

canPlaybackAudio

  • get canPlaybackAudio(): boolean
  • Returns true if audio playback is enabled

    Returns boolean

Methods

connect

disconnect

  • disconnect(stopTracks?: boolean): void

emit

  • emit<E>(event: E, ...args: Parameters<RoomEventCallbacks[E]>): boolean
  • Type parameters

    • E: keyof RoomEventCallbacks

    Parameters

    • event: E
    • Rest ...args: Parameters<RoomEventCallbacks[E]>

    Returns boolean

getParticipantByIdentity

  • getParticipantByIdentity(identity: string): undefined | Participant

startAudio

  • startAudio(): Promise<void>
  • Browsers have different policies regarding audio playback. Most requiring some form of user interaction (click/tap/etc). In those cases, audio will be silent until a click/tap triggering one of the following

    • startAudio
    • getUserMedia

    Returns Promise<void>

switchActiveDevice

  • switchActiveDevice(kind: MediaDeviceKind, deviceId: string): Promise<void>
  • Switches all active device used in this room to the given device.

    Note: setting AudioOutput is not supported on some browsers. See setSinkId

    Parameters

    • kind: MediaDeviceKind

      use videoinput for camera track, audioinput for microphone track, audiooutput to set speaker for all incoming audio tracks

    • deviceId: string

    Returns Promise<void>

Static getLocalDevices

  • getLocalDevices(kind: MediaDeviceKind): Promise<MediaDeviceInfo[]>
  • getLocalDevices abstracts navigator.mediaDevices.enumerateDevices. In particular, it handles Chrome's unique behavior of creating default devices. When encountered, it'll be removed from the list of devices. The actual default device will be placed at top.

    Parameters

    • kind: MediaDeviceKind

    Returns Promise<MediaDeviceInfo[]>

    a list of available local devices

Generated using TypeDoc