Options
All
  • Public
  • Public/Protected
  • All
Menu

Events are the primary way LiveKit notifies your application of changes.

The following are events emitted by Room, listen to room events like

room.on(RoomEvent.TrackPublished, (track, publication, participant) => {})

Index

Enumeration members

ActiveSpeakersChanged

ActiveSpeakersChanged: = "activeSpeakersChanged"

Active speakers changed. List of speakers are ordered by their audio level. loudest speakers first. This will include the LocalParticipant too.

Speaker updates are sent only to the publishing participant and their subscribers.

args: (Array<Participant>)

AudioPlaybackStatusChanged

AudioPlaybackStatusChanged: = "audioPlaybackChanged"

LiveKit will attempt to autoplay all audio tracks when you attach them to audio elements. However, if that fails, we'll notify you via AudioPlaybackStatusChanged. Room.canPlayAudio will indicate if audio playback is permitted.

ConnectionQualityChanged

ConnectionQualityChanged: = "connectionQualityChanged"

Connection quality was changed for a Participant. It'll receive updates from the local participant, as well as any RemoteParticipants that we are subscribed to.

args: (connectionQuality: ConnectionQuality, participant: Participant)

DataReceived

DataReceived: = "dataReceived"

Data received from another participant. Data packets provides the ability to use LiveKit to send/receive arbitrary payloads. All participants in the room will receive the messages sent to the room.

args: (payload: Uint8Array, participant: Participant, kind: DataPacket_Kind)

Disconnected

Disconnected: = "disconnected"

When disconnected from room. This fires when room.disconnect() is called or when an unrecoverable connection issue had occured

LocalTrackPublished

LocalTrackPublished: = "localTrackPublished"

A local track was published successfully. This event is helpful to know when to update your local UI with the newly published track.

args: (LocalTrackPublication, LocalParticipant)

LocalTrackUnpublished

LocalTrackUnpublished: = "localTrackUnpublished"

A local track was unpublished. This event is helpful to know when to remove the local track from your UI.

When a user stops sharing their screen by pressing "End" on the browser UI, this event will also fire.

args: (LocalTrackPublication, LocalParticipant)

MediaDevicesChanged

MediaDevicesChanged: = "mediaDevicesChanged"

When input or output devices on the machine have changed.

MediaDevicesError

MediaDevicesError: = "mediaDevicesError"

When we have encountered an error while attempting to create a track. The errors take place in getUserMedia(). Use MediaDeviceFailure.getFailure(error) to get the reason of failure. [[getAudioCreateError]] and [[getVideoCreateError]] will indicate if it had an error while creating the audio or video track respectively.

args: (error: Error)

ParticipantConnected

ParticipantConnected: = "participantConnected"

When a RemoteParticipant joins after the local participant. It will not emit events for participants that are already in the room

args: (RemoteParticipant)

ParticipantDisconnected

ParticipantDisconnected: = "participantDisconnected"

When a RemoteParticipant leaves after the local participant has joined.

args: (RemoteParticipant)

ParticipantMetadataChanged

ParticipantMetadataChanged: = "participantMetadataChanged"

Participant metadata is a simple way for app-specific state to be pushed to all users. When RoomService.UpdateParticipantMetadata is called to change a participant's state, all participants in the room will fire this event.

args: (prevMetadata: string, Participant)

ParticipantPermissionsChanged

ParticipantPermissionsChanged: = "participantPermissionsChanged"

A participant's permission has changed. Currently only fired on LocalParticipant. args: (prevPermissions: [[ParticipantPermission]], participant: Participant)

Reconnected

Reconnected: = "reconnected"

Fires when a reconnection has been successful.

Reconnecting

Reconnecting: = "reconnecting"

When the connection to the server has been interrupted and it's attempting to reconnect.

RoomMetadataChanged

RoomMetadataChanged: = "roomMetadataChanged"

Room metadata is a simple way for app-specific state to be pushed to all users. When RoomService.UpdateRoomMetadata is called to change a room's state, all participants in the room will fire this event.

args: (string)

StateChanged

StateChanged: = "stateChanged"

Whenever the connection state of the room changes

args: (RoomState)

TrackMuted

TrackMuted: = "trackMuted"

A track that was muted, fires on both RemoteParticipants and LocalParticipant

args: (TrackPublication, Participant)

TrackPublished

TrackPublished: = "trackPublished"

When a new track is published to room after the local participant has joined. It will not fire for tracks that are already published.

A track published doesn't mean the participant has subscribed to it. It's simply reflecting the state of the room.

args: (RemoteTrackPublication, RemoteParticipant)

TrackStreamStateChanged

TrackStreamStateChanged: = "trackStreamStateChanged"

StreamState indicates if a subscribed (remote) track has been paused by the SFU (typically this happens because of subscriber's bandwidth constraints)

When bandwidth conditions allow, the track will be resumed automatically. TrackStreamStateChanged will also be emitted when that happens.

args: (pub: RemoteTrackPublication, streamState: Track.StreamState, participant: RemoteParticipant)

TrackSubscribed

TrackSubscribed: = "trackSubscribed"

The LocalParticipant has subscribed to a new track. This event will always fire as long as new tracks are ready for use.

args: (RemoteTrack, RemoteTrackPublication, RemoteParticipant)

TrackSubscriptionFailed

TrackSubscriptionFailed: = "trackSubscriptionFailed"

Could not subscribe to a track

args: (track sid, RemoteParticipant)

TrackSubscriptionPermissionChanged

TrackSubscriptionPermissionChanged: = "trackSubscriptionPermissionChanged"

One of subscribed tracks have changed its permissions for the current participant. If permission was revoked, then the track will no longer be subscribed. If permission was granted, a TrackSubscribed event will be emitted.

args: (pub: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus, participant: RemoteParticipant)

TrackUnmuted

TrackUnmuted: = "trackUnmuted"

A track that was unmuted, fires on both RemoteParticipants and LocalParticipant

args: (TrackPublication, Participant)

TrackUnpublished

TrackUnpublished: = "trackUnpublished"

A RemoteParticipant has unpublished a track

args: (RemoteTrackPublication, RemoteParticipant)

TrackUnsubscribed

TrackUnsubscribed: = "trackUnsubscribed"

A subscribed track is no longer available. Clients should listen to this event and ensure they detach tracks.

args: (Track, RemoteTrackPublication, RemoteParticipant)

Generated using TypeDoc