Local Data Track
A data track published by the local participant. Obtain one from io.livekit.android.room.participant.LocalParticipant.publishDataTrack, then push frames with tryPush or send.
The publication stays live until unpublish is called, the SFU unpublishes the track, or the room disconnects. Dropping the last reference eventually unpublishes the track, but only once it is garbage collected — call unpublish to end the publication at a predictable point, or io.livekit.android.room.participant.LocalParticipant.withDataTrack to scope one to a block.
val result = room.localParticipant.publishDataTrack("telemetry")
result.onSuccess { track ->
track.tryPush(DataTrackFrame(payload))
track.unpublish()
}Types
Policy for send when the send queue is full.
Properties
Metadata for this track.
Whether the track is currently published. Becomes false after unpublish or if the SFU unpublishes it.
Functions
Sends frames from frames until it ends or the track is unpublished.
Pushes a frame to subscribers.
Unpublishes the track. Subsequent tryPush calls fail with DataTrackPushFrameException.TrackUnpublished.
Waits until the track is unpublished, by either the local participant or the SFU.