Table of Contents

Class DataTrackStream

Namespace
LiveKit

An active subscription to a remote data track.

public sealed class DataTrackStream
Inheritance
DataTrackStream
Inherited Members
Extension Methods

Remarks

Use ReadFrame() in a coroutine loop to receive frames:

while (!subscription.IsEos)
{
    var frameInstruction = subscription.ReadFrame();
    yield return frameInstruction;
    if (frameInstruction.IsCurrentReadDone)
    {
        ProcessFrame(frameInstruction.Frame);
    }
}

Calling Close() or dropping the subscription unsubscribes from the track.

Properties

IsEos

True if the subscription has ended (end of stream).

public bool IsEos { get; }

Property Value

bool

Methods

Close()

Explicitly close the subscription and unsubscribe from the track.

public void Close()

ReadFrame()

Prepares to read the next frame from the subscription.

public DataTrackStream.ReadFrameInstruction ReadFrame()

Returns

DataTrackStream.ReadFrameInstruction

A DataTrackStream.ReadFrameInstruction that completes when a frame is received or the subscription ends.