LocalParticipant class

Represents the current participant in the room. Instance of LocalParticipant is automatically created after successfully connecting to a Room and will be accessible from Room.localParticipant.

Inheritance
Available extensions

Properties

attributes → UnmodifiableMapView<String, String>
Attributes associated with the participant
no setterinherited
audioLevel ↔ double
Audio level between 0-1, 1 being the loudest.
getter/setter pairinherited
audioTrackPublications → List<LocalTrackPublication<LocalAudioTrack>>
A convenience property to get all audio tracks.
no setteroverride
clientProtocol → ClientProtocolVersion
Client-to-client protocol version this participant supports, as advertised in ParticipantInfo.clientProtocol. Drives the caller- and handler-side decision between RPC v1 packets and RPC v2 data streams. Absent / older-client values resolve to ClientProtocolVersion.v0; future values clamp to the highest supported version.
no setterinherited
connectionQuality → ConnectionQuality
Connection quality between the Participant and the Server.
no setterinherited
disposeFuncCount → int
no setterinherited
events → EventsEmitter<ParticipantEvent>
finalinherited
firstTrackEncryptionType → EncryptionType
no setterinherited
hasAudio → bool
true if this Participant has more than 1 AudioTrack.
no setterinherited
hashCode → int
(Equality operator) Participant.hashCode is same as sid.hashCode.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
hasVideo → bool
true if this Participant has more than 1 VideoTrack.
no setterinherited
identity ↔ String
User-assigned identity.
getter/setter pairinherited
isDisposed → bool
no setterinherited
isEncrypted → bool
no setterinherited
isMuted → bool
true if Participant is publishing an AudioTrack and is muted.
no setterinherited
isSpeaking → bool
if Participant is currently speaking.
no setterinherited
joinedAt → DateTime
when the participant joined the room
no setterinherited
kind → ParticipantKind
kind of Participant
no setterinherited
lastSpokeAt ↔ DateTime?
When the participant had last spoken.
getter/setter pairinherited
metadata ↔ String?
Client-assigned metadata, opaque to livekit.
getter/setter pairinherited
name → String
Name of the participant (readonly).
no setterinherited
permissions → ParticipantPermissions
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sid ↔ String
Server assigned unique id.
getter/setter pairinherited
state → ParticipantState
no setterinherited
trackPublications → Map<String, LocalTrackPublication<LocalTrack>>
Map of track sid => published track
finalinherited
videoTrackPublications → List<LocalTrackPublication<LocalVideoTrack>>
A convenience property to get all video tracks.
no setteroverride

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
createListener({bool synchronized = false}) → EventsListener<ParticipantEvent>
inherited
dispose() → Future<bool>
Discards any resources used by the object.
inherited
getTrackPublicationByName(String name) → LocalTrackPublication<LocalTrack>?
get a TrackPublication by its name. returns null when not found.
override
getTrackPublicationBySid(String sid) → LocalTrackPublication<LocalTrack>?
get a TrackPublication by its sid. returns null when not found.
override
getTrackPublicationBySource(TrackSource source) → LocalTrackPublication<LocalTrack>?
Tries to find a TrackPublication by its TrackSource. Otherwise, will return a compatible type of TrackPublication for the TrackSource specified. returns null when not found.
override
getTrackPublications() → List<LocalTrackPublication<LocalTrack>>
get all TrackPublications.
inherited
isCameraEnabled() → bool
Convenience property to check whether TrackSource.camera is published or not.
inherited
isMicrophoneEnabled() → bool
Convenience property to check whether TrackSource.microphone is published or not.
inherited
isScreenShareAudioEnabled() → bool
Convenience property to check whether TrackSource.screenShareAudio is published or not.
inherited
isScreenShareEnabled() → bool
Convenience property to check whether TrackSource.screenShareVideo is published or not.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onDispose(OnDisposeFunc func) → void
inherited
performRpc(PerformRpcParams params) → Future<String>

Available on LocalParticipant, provided by the RPCMethods extension

Initiate an RPC call to a remote participant. @param params - RPC call parameters. @returns A future that resolves with the response payload or rejects with RpcError. @throws RpcError on failure. Details in message.
publishAdditionalCodecForPublication(LocalTrackPublication<LocalTrack> publication, String backupCodec) → Future<void>
publishAudioTrack(LocalAudioTrack track, {AudioPublishOptions? publishOptions}) → Future<LocalTrackPublication<LocalAudioTrack>>
Publish an AudioTrack to the Room. For most cases, using setMicrophoneEnabled would be simpler and recommended.
publishData(List<int> data, {bool? reliable, List<String>? destinationIdentities, String? topic}) → Future<void>
Publish a new data payload to the room. @param reliable, when true, data will be sent reliably. @param destinationIdentities When empty, data will be forwarded to each participant in the room. @param topic, the topic under which the message gets published.
publishVideoTrack(LocalVideoTrack track, {VideoPublishOptions? publishOptions}) → Future<LocalTrackPublication<LocalVideoTrack>>
Publish a LocalVideoTrack to the Room. For most cases, using setCameraEnabled would be simpler and recommended.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removePublishedTrack(String trackSid, {bool notify = true}) → Future<void>
rePublishAllTracks() → Future<void>
sendFile(File file, {required SendFileOptions options}) → Future<Map<String, String>>

Available on LocalParticipant, provided by the DataStreamParticipantMethods extension

sendText(String text, {SendTextOptions? options}) → Future<TextStreamInfo>

Available on LocalParticipant, provided by the DataStreamParticipantMethods extension

sendTrackSubscriptionPermissions() → void
setAttributes(Map<String, String> attributes) → Future<void>
Sets and updates the attributes of the local participant. @attributes key-value pairs to set
setCameraEnabled(bool enabled, {CameraCaptureOptions? cameraCaptureOptions}) → Future<LocalTrackPublication<LocalTrack>?>
Shortcut for publishing a TrackSource.camera
setMetadata(String metadata) → Future<void>
Sets and updates the metadata of the local participant. Note: this requires CanUpdateOwnMetadata permission encoded in the token. @param metadata
setMicrophoneEnabled(bool enabled, {AudioCaptureOptions? audioCaptureOptions}) → Future<LocalTrackPublication<LocalTrack>?>
Shortcut for publishing a TrackSource.microphone
setName(String name) → Future<void>
Sets and updates the name of the local participant. Note: this requires CanUpdateOwnMetadata permission encoded in the token. @param name
setScreenShareEnabled(bool enabled, {bool? captureScreenAudio, ScreenShareCaptureOptions? screenShareCaptureOptions}) → Future<LocalTrackPublication<LocalTrack>?>
Shortcut for publishing a TrackSource.screenShareVideo
setSourceEnabled(TrackSource source, bool enabled, {bool? captureScreenAudio, AudioCaptureOptions? audioCaptureOptions, CameraCaptureOptions? cameraCaptureOptions, ScreenShareCaptureOptions? screenShareCaptureOptions}) → Future<LocalTrackPublication<LocalTrack>?>
A convenience method to publish a track for a specific TrackSource. This is the recommended method to publish tracks.
setTrackSubscriptionPermissions({required bool allParticipantsAllowed, List<ParticipantTrackPermission> trackPermissions = const []}) → void
Control who can subscribe to LocalParticipant's published tracks.
streamBytes(StreamBytesOptions? options) → Future<ByteStreamWriter>

Available on LocalParticipant, provided by the DataStreamParticipantMethods extension

streamText(StreamTextOptions? options) → Future<TextStreamWriter>

Available on LocalParticipant, provided by the DataStreamParticipantMethods extension

toString() → String
A string representation of this object.
inherited
unpublishAllTracks({bool notify = true, bool? stopOnUnpublish}) → Future<void>
Convenience method to unpublish all tracks.

Operators

operator ==(Object other) → bool
(Equality operator) Participant is considered equal when sid's are equal.
inherited