Table of Contents

Class DataTrackFrame

Namespace
LiveKit

A frame published on a data track, consisting of a payload and optional metadata.

public class DataTrackFrame
Inheritance
DataTrackFrame
Inherited Members
Extension Methods

Constructors

DataTrackFrame(byte[], ulong?)

Creates a new data track frame.

public DataTrackFrame(byte[] payload, ulong? userTimestamp = null)

Parameters

payload byte[]

The frame's payload.

userTimestamp ulong?

Optional user timestamp in milliseconds.

Properties

Payload

The frame's payload.

public byte[] Payload { get; }

Property Value

byte[]

UserTimestamp

The frame's user timestamp in milliseconds, if one is associated.

public ulong? UserTimestamp { get; }

Property Value

ulong?

Methods

DurationSinceTimestamp()

If the frame has a user timestamp, calculates how long has passed relative to the current system time.

public double? DurationSinceTimestamp()

Returns

double?

The elapsed duration in seconds, or null if no timestamp is set.

Remarks

The timestamp is assumed to be a Unix timestamp in milliseconds (as set by WithUserTimestampNow() on the publisher side).

WithUserTimestampNow()

Associates the current Unix timestamp (in milliseconds) with the frame. Returns a new DataTrackFrame with the timestamp set; the original is not modified.

public DataTrackFrame WithUserTimestampNow()

Returns

DataTrackFrame

A new DataTrackFrame with the current timestamp.