livekit_rtc.proto

  1syntax = "proto3";
  2
  3package livekit;
  4option go_package = "github.com/livekit/protocol/livekit";
  5option csharp_namespace = "LiveKit.Proto";
  6option ruby_package = "LiveKit::Proto";
  7
  8import "livekit_models.proto";
  9
 10message SignalRequest {
 11  oneof message {
 12    // initial join exchange, for publisher
 13    SessionDescription offer = 1;
 14    // participant answering publisher offer
 15    SessionDescription answer = 2;
 16    TrickleRequest trickle = 3;
 17    AddTrackRequest add_track = 4;
 18    // mute the participant's published tracks
 19    MuteTrackRequest mute = 5;
 20    // Subscribe or unsubscribe from tracks
 21    UpdateSubscription subscription = 6;
 22    // Update settings of subscribed tracks
 23    UpdateTrackSettings track_setting = 7;
 24    // Immediately terminate session
 25    LeaveRequest leave = 8;
 26    // Set active published layers, deprecated in favor of automatic tracking
 27//    SetSimulcastLayers simulcast = 9;
 28    // Update published video layers
 29    UpdateVideoLayers update_layers = 10;
 30    // Update subscriber permissions
 31    SubscriptionPermission subscription_permission = 11;
 32    // sync client's subscribe state to server during reconnect
 33    SyncState sync_state = 12;
 34    // Simulate conditions, for client validations
 35    SimulateScenario simulate = 13;
 36    // client triggered ping to server
 37    int64 ping = 14;
 38  }
 39}
 40
 41message SignalResponse {
 42  oneof message {
 43    // sent when join is accepted
 44    JoinResponse join = 1;
 45    // sent when server answers publisher
 46    SessionDescription answer = 2;
 47    // sent when server is sending subscriber an offer
 48    SessionDescription offer = 3;
 49    // sent when an ICE candidate is available
 50    TrickleRequest trickle = 4;
 51    // sent when participants in the room has changed
 52    ParticipantUpdate update = 5;
 53    // sent to the participant when their track has been published
 54    TrackPublishedResponse track_published = 6;
 55    // Immediately terminate session
 56    LeaveRequest leave = 8;
 57    // server initiated mute
 58    MuteTrackRequest mute = 9;
 59    // indicates changes to speaker status, including when they've gone to not speaking
 60    SpeakersChanged speakers_changed = 10;
 61    // sent when metadata of the room has changed
 62    RoomUpdate room_update = 11;
 63    // when connection quality changed
 64    ConnectionQualityUpdate connection_quality = 12;
 65    // when streamed tracks state changed, used to notify when any of the streams were paused due to
 66    // congestion
 67    StreamStateUpdate stream_state_update = 13;
 68    // when max subscribe quality changed, used by dynamic broadcasting to disable unused layers
 69    SubscribedQualityUpdate subscribed_quality_update = 14;
 70    // when subscription permission changed
 71    SubscriptionPermissionUpdate subscription_permission_update = 15;
 72    // update the token the client was using, to prevent an active client from using an expired token
 73    string refresh_token = 16;
 74    // server initiated track unpublish
 75    TrackUnpublishedResponse track_unpublished = 17;
 76    // respond to ping
 77    int64 pong = 18;
 78  }
 79}
 80
 81enum SignalTarget {
 82  PUBLISHER = 0;
 83  SUBSCRIBER = 1;
 84}
 85
 86message SimulcastCodec {
 87  string codec = 1;
 88  string cid = 2;
 89  bool enable_simulcast_layers = 3;
 90}
 91
 92message AddTrackRequest {
 93  // client ID of track, to match it when RTC track is received
 94  string cid = 1;
 95  string name = 2;
 96  TrackType type = 3;
 97  // to be deprecated in favor of layers
 98  uint32 width = 4;
 99  uint32 height = 5;
100  // true to add track and initialize to muted
101  bool muted = 6;
102  // true if DTX (Discontinuous Transmission) is disabled for audio
103  bool disable_dtx = 7;
104  TrackSource source = 8;
105  repeated VideoLayer layers = 9;
106
107  repeated SimulcastCodec simulcast_codecs = 10;
108
109  // server ID of track, publish new codec to exist track
110  string sid = 11;
111}
112
113message TrickleRequest {
114  string candidateInit = 1;
115  SignalTarget target = 2;
116}
117
118message MuteTrackRequest {
119  string sid = 1;
120  bool muted = 2;
121}
122
123message JoinResponse {
124  Room room = 1;
125  ParticipantInfo participant = 2;
126  repeated ParticipantInfo other_participants = 3;
127  // deprecated. use server_info.version instead.
128  string server_version = 4;
129  repeated ICEServer ice_servers = 5;
130  // use subscriber as the primary PeerConnection
131  bool subscriber_primary = 6;
132  // when the current server isn't available, return alternate url to retry connection
133  // when this is set, the other fields will be largely empty
134  string alternative_url = 7;
135  ClientConfiguration client_configuration = 8;
136  // deprecated. use server_info.region instead.
137  string server_region = 9;
138  int32 ping_timeout = 10;
139  int32 ping_interval = 11;
140  ServerInfo server_info = 12;
141}
142
143message TrackPublishedResponse {
144  string cid = 1;
145  TrackInfo track = 2;
146}
147
148message TrackUnpublishedResponse {
149  string track_sid = 1;
150}
151
152message SessionDescription {
153  string type = 1; // "answer" | "offer" | "pranswer" | "rollback"
154  string sdp = 2;
155}
156
157message ParticipantUpdate {
158  repeated ParticipantInfo participants = 1;
159}
160
161message UpdateSubscription {
162  repeated string track_sids = 1;
163  bool subscribe = 2;
164  repeated ParticipantTracks participant_tracks = 3;
165}
166
167message UpdateTrackSettings {
168  repeated string track_sids = 1;
169  // when true, the track is placed in a paused state, with no new data returned
170  bool disabled = 3;
171  // deprecated in favor of width & height
172  VideoQuality quality = 4;
173  // for video, width to receive
174  uint32 width = 5;
175  // for video, height to receive
176  uint32 height = 6;
177}
178
179message LeaveRequest {
180  // sent when server initiates the disconnect due to server-restart
181  // indicates clients should attempt full-reconnect sequence
182  bool can_reconnect = 1;
183  DisconnectReason reason = 2;
184}
185
186// message to indicate published video track dimensions are changing
187message UpdateVideoLayers {
188  string track_sid = 1;
189  repeated VideoLayer layers = 2;
190}
191
192message ICEServer {
193  repeated string urls = 1;
194  string username = 2;
195  string credential = 3;
196}
197
198message SpeakersChanged {
199  repeated SpeakerInfo speakers = 1;
200}
201
202message RoomUpdate {
203  Room room = 1;
204}
205
206message ConnectionQualityInfo {
207  string participant_sid = 1;
208  ConnectionQuality quality = 2;
209  float score = 3;
210}
211
212message ConnectionQualityUpdate {
213  repeated ConnectionQualityInfo updates = 1;
214}
215
216enum StreamState {
217  ACTIVE = 0;
218  PAUSED = 1;
219}
220
221message StreamStateInfo {
222  string participant_sid = 1;
223  string track_sid = 2;
224  StreamState state = 3;
225}
226
227message StreamStateUpdate {
228  repeated StreamStateInfo stream_states = 1;
229}
230
231message SubscribedQuality {
232  VideoQuality quality = 1;
233  bool enabled = 2;
234}
235
236message SubscribedCodec {
237  string codec = 1;
238  repeated SubscribedQuality qualities = 2;
239}
240
241message SubscribedQualityUpdate {
242  string track_sid = 1;
243  repeated SubscribedQuality subscribed_qualities = 2;
244  repeated SubscribedCodec subscribed_codecs = 3;
245}
246
247message TrackPermission {
248  // permission could be granted either by participant sid or identity
249  string participant_sid = 1;
250  bool all_tracks = 2;
251  repeated string track_sids = 3;
252  string participant_identity = 4;
253}
254
255message SubscriptionPermission {
256  bool all_participants = 1;
257  repeated TrackPermission track_permissions = 2;
258}
259
260message SubscriptionPermissionUpdate {
261  string participant_sid = 1;
262  string track_sid = 2;
263  bool allowed = 3;
264}
265
266message SyncState {
267  // last subscribe answer before reconnecting
268  SessionDescription answer = 1;
269  UpdateSubscription subscription = 2;
270  repeated TrackPublishedResponse publish_tracks = 3;
271  repeated DataChannelInfo data_channels = 4;
272  // last received server side offer before reconnecting
273  SessionDescription offer = 5;
274}
275
276message DataChannelInfo {
277  string label = 1;
278  uint32 id = 2;
279  SignalTarget target = 3;
280}
281
282enum CandidateProtocol {
283  UDP = 0;
284  TCP = 1;
285  TLS = 2;
286}
287
288message SimulateScenario {
289  oneof scenario {
290    // simulate N seconds of speaker activity
291    int32 speaker_update = 1;
292    // simulate local node failure
293    bool node_failure = 2;
294    // simulate migration
295    bool migration = 3;
296    // server to send leave
297    bool server_leave = 4;
298    // switch candidate protocol to tcp
299    CandidateProtocol switch_candidate_protocol = 5;
300  }
301}