LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
room_delegate.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 "livekit/room_event_types.h"
20#include "livekit/visibility.h"
21
22namespace livekit {
23
24class Room;
25
33class LIVEKIT_API RoomDelegate {
34public:
35 virtual ~RoomDelegate() = default;
36
37 // ------------------------------------------------------------------
38 // Participant lifecycle
39 // ------------------------------------------------------------------
40
43
46
47 // ------------------------------------------------------------------
48 // Local track publication events
49 // ------------------------------------------------------------------
50
53
56
59
60 // ------------------------------------------------------------------
61 // Remote track publication/subscription
62 // ------------------------------------------------------------------
63
65 virtual void onTrackPublished(Room&, const TrackPublishedEvent&) {}
66
69
72
75
78
80 virtual void onTrackMuted(Room&, const TrackMutedEvent&) {}
81
83 virtual void onTrackUnmuted(Room&, const TrackUnmutedEvent&) {}
84
85 // ------------------------------------------------------------------
86 // Active speakers
87 // ------------------------------------------------------------------
88
91
92 // ------------------------------------------------------------------
93 // Room info / metadata
94 // ------------------------------------------------------------------
95
98
100 virtual void onRoomSidChanged(Room&, const RoomSidChangedEvent&) {}
101
103 virtual void onRoomUpdated(Room&, const RoomUpdatedEvent&) {}
104
106 virtual void onRoomMoved(Room&, const RoomMovedEvent&) {}
107
108 // ------------------------------------------------------------------
109 // Participant info changes
110 // ------------------------------------------------------------------
111
114
117
120
123
124 // ------------------------------------------------------------------
125 // Connection quality / state
126 // ------------------------------------------------------------------
127
130
133
135 virtual void onDisconnected(Room&, const DisconnectedEvent&) {}
136
138 virtual void onReconnecting(Room&, const ReconnectingEvent&) {}
139
141 virtual void onReconnected(Room&, const ReconnectedEvent&) {}
142
143 // ------------------------------------------------------------------
144 // E2EE
145 // ------------------------------------------------------------------
146
149
150 // ------------------------------------------------------------------
151 // EOS
152 // ------------------------------------------------------------------
153
156 virtual void onRoomEos(Room&, const RoomEosEvent&) {}
157
158 // ------------------------------------------------------------------
159 // Data / transcription / chat
160 // ------------------------------------------------------------------
161
164
167
168 // ------------------------------------------------------------------
169 // Data streams
170 // ------------------------------------------------------------------
171
174
177
180
184
185 // ------------------------------------------------------------------
186 // High-level byte/text streams
187 // ------------------------------------------------------------------
188
191
194
195 // ------------------------------------------------------------------
196 // Data tracks
197 // ------------------------------------------------------------------
198
204
207
208 // ------------------------------------------------------------------
209 // Participants snapshot
210 // ------------------------------------------------------------------
211
214};
215
216} // namespace livekit
Interface for receiving room-level events.
Definition room_delegate.h:33
virtual void onTrackUnmuted(Room &, const TrackUnmutedEvent &)
Called when a track is unmuted.
Definition room_delegate.h:83
virtual void onByteStreamOpened(Room &, const ByteStreamOpenedEvent &)
Called when a high-level byte stream reader is opened.
Definition room_delegate.h:190
virtual void onLocalTrackUnpublished(Room &, const LocalTrackUnpublishedEvent &)
Called when a local track is unpublished.
Definition room_delegate.h:55
virtual void onRoomSidChanged(Room &, const RoomSidChangedEvent &)
Called when the room SID changes (e.g., after migration).
Definition room_delegate.h:100
virtual void onParticipantsUpdated(Room &, const ParticipantsUpdatedEvent &)
Called when a snapshot of participants has been updated.
Definition room_delegate.h:213
virtual void onRoomUpdated(Room &, const RoomUpdatedEvent &)
Called when any room info is updated.
Definition room_delegate.h:103
virtual void onLocalTrackPublished(Room &, const LocalTrackPublishedEvent &)
Called when a local track is successfully published.
Definition room_delegate.h:52
virtual void onParticipantConnected(Room &, const ParticipantConnectedEvent &)
Called when a new remote participant joins the room.
Definition room_delegate.h:42
virtual void onParticipantMetadataChanged(Room &, const ParticipantMetadataChangedEvent &)
Called when a participant's metadata is updated.
Definition room_delegate.h:113
virtual void onUserPacketReceived(Room &, const UserDataPacketEvent &)
Called when a user data packet (non-SIP) is received.
Definition room_delegate.h:163
virtual void onActiveSpeakersChanged(Room &, const ActiveSpeakersChangedEvent &)
Called when the list of active speakers changes.
Definition room_delegate.h:90
virtual void onTrackPublished(Room &, const TrackPublishedEvent &)
Called when a remote participant publishes a track.
Definition room_delegate.h:65
virtual void onTrackSubscriptionFailed(Room &, const TrackSubscriptionFailedEvent &)
Called when subscribing to a remote track fails.
Definition room_delegate.h:77
virtual void onConnectionQualityChanged(Room &, const ConnectionQualityChangedEvent &)
Called when a participant's connection quality changes.
Definition room_delegate.h:129
virtual void onDisconnected(Room &, const DisconnectedEvent &)
Called when the room is disconnected.
Definition room_delegate.h:135
virtual void onParticipantAttributesChanged(Room &, const ParticipantAttributesChangedEvent &)
Called when a participant's attributes are updated.
Definition room_delegate.h:119
virtual void onTrackMuted(Room &, const TrackMutedEvent &)
Called when a track is muted.
Definition room_delegate.h:80
virtual void onReconnecting(Room &, const ReconnectingEvent &)
Called before the SDK attempts to reconnect.
Definition room_delegate.h:138
virtual void onLocalTrackSubscribed(Room &, const LocalTrackSubscribedEvent &)
Called when a local track gains its first subscriber.
Definition room_delegate.h:58
virtual void onParticipantNameChanged(Room &, const ParticipantNameChangedEvent &)
Called when a participant's name is changed.
Definition room_delegate.h:116
virtual void onDataTrackUnpublished(Room &, const DataTrackUnpublishedEvent &)
Called when a remote participant unpublishes a data track.
Definition room_delegate.h:206
virtual void onRoomEos(Room &, const RoomEosEvent &)
Called when the room reaches end-of-stream and will not emit further events.
Definition room_delegate.h:156
virtual void onDataChannelBufferedAmountLowThresholdChanged(Room &, const DataChannelBufferedAmountLowThresholdChangedEvent &)
Called when a data channel's buffered amount falls below its low threshold.
Definition room_delegate.h:182
virtual void onTrackUnsubscribed(Room &, const TrackUnsubscribedEvent &)
Called when a remote track is unsubscribed.
Definition room_delegate.h:74
virtual void onSipDtmfReceived(Room &, const SipDtmfReceivedEvent &)
Called when a SIP DTMF packet is received.
Definition room_delegate.h:166
virtual void onConnectionStateChanged(Room &, const ConnectionStateChangedEvent &)
Called when the room's connection state changes.
Definition room_delegate.h:132
virtual void onDataStreamHeaderReceived(Room &, const DataStreamHeaderReceivedEvent &)
Called when a data stream header is received.
Definition room_delegate.h:173
virtual void onParticipantDisconnected(Room &, const ParticipantDisconnectedEvent &)
Called when a remote participant leaves the room.
Definition room_delegate.h:45
virtual void onRoomMoved(Room &, const RoomMovedEvent &)
Called when the participant is moved to another room.
Definition room_delegate.h:106
virtual void onRoomMetadataChanged(Room &, const RoomMetadataChangedEvent &)
Called when the room's metadata changes.
Definition room_delegate.h:97
virtual void onReconnected(Room &, const ReconnectedEvent &)
Called after the SDK successfully reconnects.
Definition room_delegate.h:141
virtual void onParticipantEncryptionStatusChanged(Room &, const ParticipantEncryptionStatusChangedEvent &)
Called when a participant's encryption status changes.
Definition room_delegate.h:122
virtual void onDataStreamTrailerReceived(Room &, const DataStreamTrailerReceivedEvent &)
Called when a data stream trailer is received.
Definition room_delegate.h:179
virtual void onTextStreamOpened(Room &, const TextStreamOpenedEvent &)
Called when a high-level text stream reader is opened.
Definition room_delegate.h:193
virtual void onTrackUnpublished(Room &, const TrackUnpublishedEvent &)
Called when a remote participant unpublishes a track.
Definition room_delegate.h:68
virtual void onE2eeStateChanged(Room &, const E2eeStateChangedEvent &)
Called when a participant's end-to-end encryption state changes.
Definition room_delegate.h:148
virtual void onDataTrackPublished(Room &, const DataTrackPublishedEvent &)
Called when a remote participant publishes a data track.
Definition room_delegate.h:203
virtual void onDataStreamChunkReceived(Room &, const DataStreamChunkReceivedEvent &)
Called when a data stream chunk is received.
Definition room_delegate.h:176
virtual void onTrackSubscribed(Room &, const TrackSubscribedEvent &)
Called when a remote track is successfully subscribed.
Definition room_delegate.h:71
Represents a LiveKit room session.
Definition room.h:98
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
Fired when the list of active speakers changes.
Definition room_event_types.h:431
Fired when a high-level byte stream reader is opened.
Definition room_event_types.h:588
Fired when a participant's connection quality estimate changes.
Definition room_event_types.h:494
Fired when the room's connection state changes.
Definition room_event_types.h:531
Fired when a data channel's buffered amount falls below its low threshold.
Definition room_event_types.h:579
Fired when a data stream chunk is received.
Definition room_event_types.h:561
Fired when a data stream header is received.
Definition room_event_types.h:552
Fired when a data stream trailer is received.
Definition room_event_types.h:570
Fired when a participant publishes a data track.
Definition room_event_types.h:637
Fired when a remote participant unpublishes a data track.
Definition room_event_types.h:643
Fired when the room is disconnected.
Definition room_event_types.h:537
Fired when a participant's E2EE state changes.
Definition room_event_types.h:624
Fired when a local track is successfully published.
Definition room_event_types.h:338
Fired when a local track gets its first subscriber.
Definition room_event_types.h:353
Fired when a local track is unpublished.
Definition room_event_types.h:347
Fired when a participant's attributes change.
Definition room_event_types.h:476
Fired when a remote participant joins the room.
Definition room_event_types.h:323
Fired when a remote participant leaves the room.
Definition room_event_types.h:329
Fired when a participant's encryption status changes.
Definition room_event_types.h:485
Fired when a participant's metadata is updated.
Definition room_event_types.h:452
Fired when a participant's name changes.
Definition room_event_types.h:464
Fired when a batch of participants has been updated.
Definition room_event_types.h:618
Fired after successfully reconnecting.
Definition room_event_types.h:546
Fired just before attempting to reconnect.
Definition room_event_types.h:543
Fired when the room has reached end-of-stream (no more events).
Definition room_event_types.h:549
Fired when room metadata is updated.
Definition room_event_types.h:437
Fired when the participant has been moved to another room.
Definition room_event_types.h:612
Fired when the room SID changes (e.g., after migration).
Definition room_event_types.h:446
Fired when the room's info is updated.
Definition room_event_types.h:606
Fired when a SIP DTMF packet is received.
Definition room_event_types.h:519
Fired when a high-level text stream reader is opened.
Definition room_event_types.h:597
Fired when a track is muted.
Definition room_event_types.h:413
Fired when a remote participant publishes a track.
Definition room_event_types.h:359
Fired when a remote track is successfully subscribed.
Definition room_event_types.h:377
Fired when subscribing to a remote track fails.
Definition room_event_types.h:401
Fired when a track is unmuted.
Definition room_event_types.h:422
Fired when a remote participant unpublishes a track.
Definition room_event_types.h:368
Fired when a remote track is unsubscribed.
Definition room_event_types.h:389
Fired when a user data packet (non-SIP) is received.
Definition room_event_types.h:503