publish Data Track
Publishes a data track, allowing this participant to send frames to subscribers.
The publication stays live until LocalDataTrack.unpublish is called, the SFU unpublishes the track, or the room disconnects. Dropping the last reference to the returned track eventually unpublishes it, but only once it is garbage collected — call LocalDataTrack.unpublish to end the publication at a predictable point, or use withDataTrack to scope it to a block.
val result = room.localParticipant.publishDataTrack("telemetry")
result.onSuccess { track ->
track.tryPush(DataTrackFrame(payload))
track.unpublish()
}Return
A successful Result containing the published LocalDataTrack, or a failure containing DataTrackPublishException.
When self-hosting the LiveKit SFU, a DataTrackPublishException.Timeout may indicate a release that predates data track support.
Parameters
Track name visible to other participants. Must be unique per publisher.
Optional encoding and schema metadata, surfaced to subscribers via io.livekit.android.room.datatrack.DataTrackInfo.