LiveKit C++ SDK
Real-time audio/video 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 "livekit/data_track_error.h"
20#include "livekit/data_track_info.h"
21#include "livekit/data_track_stream.h"
22#include "livekit/ffi_handle.h"
23#include "livekit/result.h"
24
25#include <memory>
26#include <string>
27
28namespace livekit {
29
30namespace proto {
31class OwnedRemoteDataTrack;
32}
33
54public:
55 ~RemoteDataTrack() = default;
56
57 RemoteDataTrack(const RemoteDataTrack &) = delete;
58 RemoteDataTrack &operator=(const RemoteDataTrack &) = delete;
59
61 const DataTrackInfo &info() const noexcept { return info_; }
62
64 const std::string &publisherIdentity() const noexcept {
65 return publisher_identity_;
66 }
67
69 bool isPublished() const;
70
71#ifdef LIVEKIT_TEST_ACCESS
73 uintptr_t testFfiHandleId() const noexcept { return ffi_handle_id(); }
74#endif
75
83 subscribe(const DataTrackStream::Options &options = {});
84
85private:
86 friend class Room;
87
88 explicit RemoteDataTrack(const proto::OwnedRemoteDataTrack &owned);
89
90 uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
92 FfiHandle handle_;
93
95 DataTrackInfo info_;
96
98 std::string publisher_identity_;
99};
100
101} // namespace livekit
Definition remote_data_track.h:53
const DataTrackInfo & info() const noexcept
Metadata about this data track.
Definition remote_data_track.h:61
Result< std::shared_ptr< DataTrackStream >, SubscribeDataTrackError > subscribe(const DataTrackStream::Options &options={})
const std::string & publisherIdentity() const noexcept
Identity of the remote participant who published this track.
Definition remote_data_track.h:64
bool isPublished() const
Whether the track is still published by the remote participant.
Definition result.h:42
Definition room.h:97
Definition data_track_info.h:29
Definition data_track_stream.h:57
Definition data_track_error.h:78