LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
remote_participant.h
1/*
2 * Copyright 2025 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 "participant.h"
20
21#include <memory>
22#include <string>
23#include <unordered_map>
24
25namespace livekit {
26
27class RemoteTrackPublication;
28
30public:
31 using PublicationMap =
32 std::unordered_map<std::string, std::shared_ptr<RemoteTrackPublication>>;
33
34 RemoteParticipant(FfiHandle handle, std::string sid, std::string name,
35 std::string identity, std::string metadata,
36 std::unordered_map<std::string, std::string> attributes,
37 ParticipantKind kind, DisconnectReason reason);
38
39 // A dictionary of track publications associated with the participant.
40 const PublicationMap &trackPublications() const noexcept {
41 return track_publications_;
42 }
43
44 // Optional: non-const access if you want to mutate in-place.
45 PublicationMap &mutableTrackPublications() noexcept {
46 return track_publications_;
47 }
48
49 std::string to_string() const;
50
51protected:
52 // Called by Room events like kTrackMuted. This is internal plumbing and not
53 // intended to be called directly by SDK users.
54 std::shared_ptr<TrackPublication>
55 findTrackPublication(const std::string &sid) const override;
56 friend class Room;
57
58private:
59 PublicationMap track_publications_;
60};
61
62// Convenience for logging / streaming
63std::ostream &operator<<(std::ostream &os,
64 const RemoteParticipant &participant);
65
66} // namespace livekit
RAII wrapper for an FFI handle (uintptr_t) coming from Rust.
Definition ffi_handle.h:29
Definition participant.h:31
Definition remote_participant.h:29
Definition room.h:89