LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
remote_data_track.h
1/*
2 * Copyright 2026 LiveKit
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <memory>
20#include <string>
21
22#include "livekit/data_track_error.h"
23#include "livekit/data_track_info.h"
24#include "livekit/data_track_stream.h"
25#include "livekit/ffi_handle.h"
26#include "livekit/result.h"
27#include "livekit/visibility.h"
28
29namespace livekit {
30
31namespace proto {
32class OwnedRemoteDataTrack;
33}
34
53public:
54 ~RemoteDataTrack() = default;
55
56 RemoteDataTrack(const RemoteDataTrack&) = delete;
57 RemoteDataTrack& operator=(const RemoteDataTrack&) = delete;
58
60 const DataTrackInfo& info() const noexcept { return info_; }
61
63 const std::string& publisherIdentity() const noexcept { return publisher_identity_; }
64
66 LIVEKIT_API bool isPublished() const;
67
68#ifdef LIVEKIT_TEST_ACCESS
70 uintptr_t testFfiHandleId() const noexcept { return ffiHandleId(); }
71#endif
72
78 const DataTrackStream::Options& options = {});
79
80private:
81 friend class Room;
82
83 explicit RemoteDataTrack(const proto::OwnedRemoteDataTrack& owned);
84
85 uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
87 FfiHandle handle_;
88
90 DataTrackInfo info_;
91
93 std::string publisher_identity_;
94};
95
96} // namespace livekit
uintptr_t get() const noexcept
Get the raw handle value.
Represents a data track published by a remote participant.
Definition remote_data_track.h:52
const DataTrackInfo & info() const noexcept
Metadata about this data track.
Definition remote_data_track.h:60
const std::string & publisherIdentity() const noexcept
Identity of the remote participant who published this track.
Definition remote_data_track.h:63
LIVEKIT_API Result< std::shared_ptr< DataTrackStream >, SubscribeDataTrackError > subscribe(const DataTrackStream::Options &options={})
Subscribe to this remote data track.
LIVEKIT_API bool isPublished() const
Whether the track is still published by the remote participant.
Lightweight success-or-error return type for non-exceptional API failures.
Definition result.h:40
Represents a LiveKit room session.
Definition room.h:98
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
Metadata about a published data track.
Definition data_track_info.h:27
Options for subscribing to a remote data track stream.
Definition data_track_stream.h:57
Error details returned when subscribing to a remote data track fails.
Definition data_track_error.h:83