LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data 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 <memory>
20#include <string>
21#include <unordered_map>
22
23#include "livekit/participant.h"
24#include "livekit/visibility.h"
25
26namespace livekit {
27
28class RemoteTrackPublication;
29
31class LIVEKIT_API RemoteParticipant : public Participant {
32public:
33 using PublicationMap = std::unordered_map<std::string, std::shared_ptr<RemoteTrackPublication>>;
34
35 RemoteParticipant(FfiHandle handle, std::string sid, std::string name, std::string identity, std::string metadata,
36 std::unordered_map<std::string, std::string> attributes, ParticipantKind kind,
37 DisconnectReason reason);
38
40 const PublicationMap& trackPublications() const noexcept { return track_publications_; }
41
43 PublicationMap& mutableTrackPublications() noexcept { return track_publications_; }
44
45 std::string toString() const;
46
47protected:
50 std::shared_ptr<TrackPublication> findTrackPublication(const std::string& sid) const override;
51 friend class Room;
52
53private:
54 PublicationMap track_publications_;
55};
56
58LIVEKIT_API std::ostream& operator<<(std::ostream& os, const RemoteParticipant& participant);
59
60} // namespace livekit
RAII wrapper for an FFI handle (uintptr_t) coming from Rust.
Definition ffi_handle.h:29
Base class for local and remote room participants.
Definition participant.h:34
Represents a remote participant in a LiveKit room.
Definition remote_participant.h:31
std::shared_ptr< TrackPublication > findTrackPublication(const std::string &sid) const override
Called by Room events like kTrackMuted.
PublicationMap & mutableTrackPublications() noexcept
Optional: non-const access if you want to mutate in-place.
Definition remote_participant.h:43
const PublicationMap & trackPublications() const noexcept
A dictionary of track publications associated with the participant.
Definition remote_participant.h:40
Represents a LiveKit room session.
Definition room.h:98
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
LIVEKIT_API std::ostream & operator<<(std::ostream &os, const RemoteParticipant &participant)
Convenience for logging / streaming.
ParticipantKind
Identifies the type of participant connected to a room.
Definition participant.h:31
DisconnectReason
Reason why a participant or room was disconnected.
Definition room_event_types.h:80