LiveKit C++ Client SDK v1.4.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
146 virtual void onTokenRefreshed(Room&, const TokenRefreshedEvent&) {}
147
148 // ------------------------------------------------------------------
149 // E2EE
150 // ------------------------------------------------------------------
151
154
155 // ------------------------------------------------------------------
156 // EOS
157 // ------------------------------------------------------------------
158
161 virtual void onRoomEos(Room&, const RoomEosEvent&) {}
162
163 // ------------------------------------------------------------------
164 // Data / transcription / chat
165 // ------------------------------------------------------------------
166
169
172
173 // ------------------------------------------------------------------
174 // Data streams
175 // ------------------------------------------------------------------
176
179
182
185
189
190 // ------------------------------------------------------------------
191 // High-level byte/text streams
192 // ------------------------------------------------------------------
193
196
199
200 // ------------------------------------------------------------------
201 // Data tracks
202 // ------------------------------------------------------------------
203
209
212
213 // ------------------------------------------------------------------
214 // Participants snapshot
215 // ------------------------------------------------------------------
216
219};
220
221} // 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:195
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:218
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:168
virtual void onTokenRefreshed(Room &, const TokenRefreshedEvent &)
Called when the server refreshes the session access token.
Definition room_delegate.h:146
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:211
virtual void onRoomEos(Room &, const RoomEosEvent &)
Called when the room reaches end-of-stream and will not emit further events.
Definition room_delegate.h:161
virtual void onDataChannelBufferedAmountLowThresholdChanged(Room &, const DataChannelBufferedAmountLowThresholdChangedEvent &)
Called when a data channel's buffered amount falls below its low threshold.
Definition room_delegate.h:187
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:171
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:178
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:184
virtual void onTextStreamOpened(Room &, const TextStreamOpenedEvent &)
Called when a high-level text stream reader is opened.
Definition room_delegate.h:198
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:153
virtual void onDataTrackPublished(Room &, const DataTrackPublishedEvent &)
Called when a remote participant publishes a data track.
Definition room_delegate.h:208
virtual void onDataStreamChunkReceived(Room &, const DataStreamChunkReceivedEvent &)
Called when a data stream chunk is received.
Definition room_delegate.h:181
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:132
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:477
Fired when a high-level byte stream reader is opened.
Definition room_event_types.h:643
Fired when a participant's connection quality estimate changes.
Definition room_event_types.h:540
Fired when the room's connection state changes.
Definition room_event_types.h:577
Fired when a data channel's buffered amount falls below its low threshold.
Definition room_event_types.h:634
Fired when a data stream chunk is received.
Definition room_event_types.h:616
Fired when a data stream header is received.
Definition room_event_types.h:607
Fired when a data stream trailer is received.
Definition room_event_types.h:625
Fired when a participant publishes a data track.
Definition room_event_types.h:692
Fired when a remote participant unpublishes a data track.
Definition room_event_types.h:698
Fired when the room is disconnected.
Definition room_event_types.h:583
Fired when a participant's E2EE state changes.
Definition room_event_types.h:679
Fired when a local track is successfully published.
Definition room_event_types.h:384
Fired when a local track gets its first subscriber.
Definition room_event_types.h:399
Fired when a local track is unpublished.
Definition room_event_types.h:393
Fired when a participant's attributes change.
Definition room_event_types.h:522
Fired when a remote participant joins the room.
Definition room_event_types.h:369
Fired when a remote participant leaves the room.
Definition room_event_types.h:375
Fired when a participant's encryption status changes.
Definition room_event_types.h:531
Fired when a participant's metadata is updated.
Definition room_event_types.h:498
Fired when a participant's name changes.
Definition room_event_types.h:510
Fired when a batch of participants has been updated.
Definition room_event_types.h:673
Fired after successfully reconnecting.
Definition room_event_types.h:592
Fired just before attempting to reconnect.
Definition room_event_types.h:589
Fired when the room has reached end-of-stream (no more events).
Definition room_event_types.h:604
Fired when room metadata is updated.
Definition room_event_types.h:483
Fired when the participant has been moved to another room.
Definition room_event_types.h:667
Fired when the room SID changes (e.g., after migration).
Definition room_event_types.h:492
Fired when the room's info is updated.
Definition room_event_types.h:661
Fired when a SIP DTMF packet is received.
Definition room_event_types.h:565
Fired when a high-level text stream reader is opened.
Definition room_event_types.h:652
Fired when the server refreshes the session access token.
Definition room_event_types.h:598
Fired when a track is muted.
Definition room_event_types.h:459
Fired when a remote participant publishes a track.
Definition room_event_types.h:405
Fired when a remote track is successfully subscribed.
Definition room_event_types.h:423
Fired when subscribing to a remote track fails.
Definition room_event_types.h:447
Fired when a track is unmuted.
Definition room_event_types.h:468
Fired when a remote participant unpublishes a track.
Definition room_event_types.h:414
Fired when a remote track is unsubscribed.
Definition room_event_types.h:435
Fired when a user data packet (non-SIP) is received.
Definition room_event_types.h:549