LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
livekit::RemoteDataTrack Class Reference

#include <remote_data_track.h>

Public Member Functions

 RemoteDataTrack (const RemoteDataTrack &)=delete
 
RemoteDataTrackoperator= (const RemoteDataTrack &)=delete
 
const DataTrackInfoinfo () const noexcept
 Metadata about this data track.
 
const std::string & publisherIdentity () const noexcept
 Identity of the remote participant who published this track.
 
bool isPublished () const
 Whether the track is still published by the remote participant.
 
Result< std::shared_ptr< DataTrackStream >, SubscribeDataTrackErrorsubscribe (const DataTrackStream::Options &options={})
 

Friends

class Room
 

Detailed Description

Represents a data track published by a remote participant.

Discovered via the DataTrackPublishedEvent room event. Unlike audio/video tracks, remote data tracks require an explicit subscribe() call to begin receiving frames.

Typical usage:

// In RoomDelegate::onDataTrackPublished callback: auto sub_result = remoteDataTrack->subscribe(); if (sub_result) { auto sub = sub_result.value(); DataTrackFrame frame; while (sub->read(frame)) { // process frame } }

Member Function Documentation

◆ subscribe()

Result< std::shared_ptr< DataTrackStream >, SubscribeDataTrackError > livekit::RemoteDataTrack::subscribe ( const DataTrackStream::Options options = {})

Subscribe to this remote data track.

Returns a DataTrackStream that delivers frames via blocking read(). Destroy the stream to unsubscribe.


The documentation for this class was generated from the following file: