client assigned identity, encoded in JWT token
if participant is currently speaking
Optional
lastOptional
metadataclient metadata, opaque to livekit
Optional
nameclient assigned display name, encoded in JWT token
Optional
permissionsserver assigned unique id
map of track sid => all published tracks
participant attributes, similar to metadata, but as a key/value map
when participant joined the room
Creates a screen capture tracks with getDisplayMedia(). A LocalVideoTrack is always created and returned. If { audio: true }, and the browser supports audio capture, a LocalAudioTrack is also created.
Optional
options: ScreenShareCaptureOptionsCreate local camera and/or microphone tracks
Optional
options: CreateLocalTracksOptionsFinds the first track that matches the source filter, for example, getting the user's camera track with getTrackBySource(Track.Source.Camera).
Finds the first track that matches the track's name.
Initiate an RPC call to a remote participant
Parameters for initiating the RPC call, see PerformRpcParams
A promise that resolves with the response payload or rejects with an error.
Publish a new data payload to the room. Data will be forwarded to each participant in the room if the destination field in publishOptions is empty
Uint8Array of the payload. To send string data, use TextEncoder.encode
optionally specify a reliable
, topic
and destination
Publish a new track to the room
Optional
options: TrackPublishOptionsEstablishes the participant as a receiver for calls of the specified RPC method. Will overwrite any existing callback for the same method.
The name of the indicated RPC method
Will be invoked when an RPC request for this method is received
A promise that resolves when the method is successfully registered
room.localParticipant?.registerRpcMethod(
'greet',
async (data: RpcInvocationData) => {
console.log(`Received greeting from ${data.callerIdentity}: ${data.payload}`);
return `Hello, ${data.callerIdentity}!`;
}
);
The handler should return a Promise that resolves to a string.
If unable to respond within responseTimeout
, the request will result in an error on the caller's side.
You may throw errors of type RpcError
with a string message
in the handler,
and they will be received on the caller's side with the message intact.
Other errors thrown in your handler will not be transmitted as-is, and will instead arrive to the caller as 1500
("Application Error").
Optional
options: TrackPublishOptionsSet or update participant attributes. It will make updates only to keys that
are present in attributes
, and will not override others.
Note: this requires canUpdateOwnMetadata
permission.
attributes to update
Enable or disable a participant's camera track.
If a track has already published, it'll mute or unmute the track.
Resolves with a LocalTrackPublication
instance if successful and undefined
otherwise
Optional
options: VideoCaptureOptionsOptional
publishOptions: TrackPublishOptionsEnable or disable a participant's microphone track.
If a track has already published, it'll mute or unmute the track.
Resolves with a LocalTrackPublication
instance if successful and undefined
otherwise
Optional
options: AudioCaptureOptionsOptional
publishOptions: TrackPublishOptionsStart or stop sharing a participant's screen
Resolves with a LocalTrackPublication
instance if successful and undefined
otherwise
Optional
options: ScreenShareCaptureOptionsOptional
publishOptions: TrackPublishOptionsControl who can subscribe to LocalParticipant's published tracks.
By default, all participants can subscribe. This allows fine-grained control over who is able to subscribe at a participant and track level.
Note: if access is given at a track-level (i.e. both [allParticipantsAllowed] and [ParticipantTrackPermission.allTracksAllowed] are false), any newer published tracks will not grant permissions to any participants and will require a subsequent permissions update to allow subscription.
Allows all participants to subscribe all tracks. Takes precedence over [[participantTrackPermissions]] if set to true. By default this is set to true.
Full list of individual permissions per participant/track. Any omitted participants will not receive any permissions.
Optional
stopOnUnpublish: boolean
audio level between 0-1.0, 1 being loudest, 0 being softest