@volter/twin-livekit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +106 -0
  3. package/dist/src/cli.d.ts +2 -0
  4. package/dist/src/cli.js +23 -0
  5. package/dist/src/egress-service-cli.d.ts +2 -0
  6. package/dist/src/egress-service-cli.js +101 -0
  7. package/dist/src/index.d.ts +14 -0
  8. package/dist/src/index.js +53 -0
  9. package/dist/src/livekit-budget.d.ts +57 -0
  10. package/dist/src/livekit-budget.js +131 -0
  11. package/dist/src/livekit-capabilities.d.ts +3 -0
  12. package/dist/src/livekit-capabilities.js +728 -0
  13. package/dist/src/livekit-conformance.d.ts +8 -0
  14. package/dist/src/livekit-conformance.js +13 -0
  15. package/dist/src/livekit-connector.d.ts +130 -0
  16. package/dist/src/livekit-connector.js +382 -0
  17. package/dist/src/livekit-data.d.ts +86 -0
  18. package/dist/src/livekit-data.js +246 -0
  19. package/dist/src/livekit-perform-harness.d.ts +5 -0
  20. package/dist/src/livekit-perform-harness.js +17 -0
  21. package/dist/src/livekit-server.d.ts +23 -0
  22. package/dist/src/livekit-server.js +45 -0
  23. package/dist/src/livekit-service-cli.d.ts +2 -0
  24. package/dist/src/livekit-service-cli.js +88 -0
  25. package/dist/src/livekit-token.d.ts +68 -0
  26. package/dist/src/livekit-token.js +76 -0
  27. package/dist/src/livekit-twin.d.ts +4 -0
  28. package/dist/src/livekit-twin.js +1161 -0
  29. package/dist/src/livekit-types.d.ts +203 -0
  30. package/dist/src/livekit-types.js +1 -0
  31. package/dist/src/livekit-webhook.d.ts +26 -0
  32. package/dist/src/livekit-webhook.js +79 -0
  33. package/dist/src/redis-service-cli.d.ts +2 -0
  34. package/dist/src/redis-service-cli.js +35 -0
  35. package/dist/test-fixtures/livekit-openapi-operations.SOURCE.md +88 -0
  36. package/dist/test-fixtures/livekit-openapi-operations.json +442 -0
  37. package/dist/test-fixtures/protobufs/cloud_replay.proto +82 -0
  38. package/dist/test-fixtures/protobufs/livekit_agent.proto +185 -0
  39. package/dist/test-fixtures/protobufs/livekit_agent_dispatch.proto +103 -0
  40. package/dist/test-fixtures/protobufs/livekit_agent_simulation.proto +422 -0
  41. package/dist/test-fixtures/protobufs/livekit_agent_worker.proto +29 -0
  42. package/dist/test-fixtures/protobufs/livekit_agentdb.proto +226 -0
  43. package/dist/test-fixtures/protobufs/livekit_analytics.proto +312 -0
  44. package/dist/test-fixtures/protobufs/livekit_cloud_agent.proto +376 -0
  45. package/dist/test-fixtures/protobufs/livekit_connector.proto +41 -0
  46. package/dist/test-fixtures/protobufs/livekit_connector_twilio.proto +65 -0
  47. package/dist/test-fixtures/protobufs/livekit_connector_whatsapp.proto +171 -0
  48. package/dist/test-fixtures/protobufs/livekit_egress.proto +641 -0
  49. package/dist/test-fixtures/protobufs/livekit_ingress.proto +222 -0
  50. package/dist/test-fixtures/protobufs/livekit_internal.proto +228 -0
  51. package/dist/test-fixtures/protobufs/livekit_metrics.proto +103 -0
  52. package/dist/test-fixtures/protobufs/livekit_models.proto +992 -0
  53. package/dist/test-fixtures/protobufs/livekit_phone_number.proto +151 -0
  54. package/dist/test-fixtures/protobufs/livekit_room.proto +312 -0
  55. package/dist/test-fixtures/protobufs/livekit_rtc.proto +673 -0
  56. package/dist/test-fixtures/protobufs/livekit_sip.proto +1000 -0
  57. package/dist/test-fixtures/protobufs/livekit_token_source.proto +49 -0
  58. package/dist/test-fixtures/protobufs/livekit_webhook.proto +62 -0
  59. package/package.json +58 -0
  60. package/src/cli.ts +22 -0
  61. package/src/egress-service-cli.ts +111 -0
  62. package/src/index.ts +103 -0
  63. package/src/livekit-budget.ts +158 -0
  64. package/src/livekit-capabilities.ts +789 -0
  65. package/src/livekit-conformance.ts +15 -0
  66. package/src/livekit-connector.ts +406 -0
  67. package/src/livekit-data.ts +278 -0
  68. package/src/livekit-perform-harness.ts +17 -0
  69. package/src/livekit-server.ts +67 -0
  70. package/src/livekit-service-cli.ts +93 -0
  71. package/src/livekit-token.ts +133 -0
  72. package/src/livekit-twin.ts +1162 -0
  73. package/src/livekit-types.ts +211 -0
  74. package/src/livekit-webhook.ts +91 -0
  75. package/src/redis-service-cli.ts +39 -0
  76. package/test-fixtures/livekit-openapi-operations.SOURCE.md +88 -0
  77. package/test-fixtures/livekit-openapi-operations.json +442 -0
  78. package/test-fixtures/protobufs/cloud_replay.proto +82 -0
  79. package/test-fixtures/protobufs/livekit_agent.proto +185 -0
  80. package/test-fixtures/protobufs/livekit_agent_dispatch.proto +103 -0
  81. package/test-fixtures/protobufs/livekit_agent_simulation.proto +422 -0
  82. package/test-fixtures/protobufs/livekit_agent_worker.proto +29 -0
  83. package/test-fixtures/protobufs/livekit_agentdb.proto +226 -0
  84. package/test-fixtures/protobufs/livekit_analytics.proto +312 -0
  85. package/test-fixtures/protobufs/livekit_cloud_agent.proto +376 -0
  86. package/test-fixtures/protobufs/livekit_connector.proto +41 -0
  87. package/test-fixtures/protobufs/livekit_connector_twilio.proto +65 -0
  88. package/test-fixtures/protobufs/livekit_connector_whatsapp.proto +171 -0
  89. package/test-fixtures/protobufs/livekit_egress.proto +641 -0
  90. package/test-fixtures/protobufs/livekit_ingress.proto +222 -0
  91. package/test-fixtures/protobufs/livekit_internal.proto +228 -0
  92. package/test-fixtures/protobufs/livekit_metrics.proto +103 -0
  93. package/test-fixtures/protobufs/livekit_models.proto +992 -0
  94. package/test-fixtures/protobufs/livekit_phone_number.proto +151 -0
  95. package/test-fixtures/protobufs/livekit_room.proto +312 -0
  96. package/test-fixtures/protobufs/livekit_rtc.proto +673 -0
  97. package/test-fixtures/protobufs/livekit_sip.proto +1000 -0
  98. package/test-fixtures/protobufs/livekit_token_source.proto +49 -0
  99. package/test-fixtures/protobufs/livekit_webhook.proto +62 -0
@@ -0,0 +1,992 @@
1
+ // Copyright 2023 LiveKit, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package livekit;
18
+
19
+ import "google/protobuf/timestamp.proto";
20
+ import "livekit_metrics.proto";
21
+ import "logger/options.proto";
22
+
23
+ option csharp_namespace = "LiveKit.Proto";
24
+ option go_package = "github.com/livekit/protocol/livekit";
25
+ option ruby_package = "LiveKit::Proto";
26
+
27
+ message Pagination {
28
+ string after_id = 1 [(logger.name) = "afterID"]; // list entities which IDs are greater
29
+ int32 limit = 2;
30
+ }
31
+
32
+ message TokenPagination {
33
+ string token = 1;
34
+ }
35
+
36
+ // ListUpdate is used for updated APIs where 'repeated string' field is modified.
37
+ message ListUpdate {
38
+ repeated string set = 1; // set the field to a new list
39
+ repeated string add = 2; // append items to a list, avoiding duplicates
40
+ repeated string remove = 3; // delete items from a list
41
+ bool clear = 4; // sets the list to an empty list
42
+ }
43
+
44
+ message Room {
45
+ string sid = 1;
46
+ string name = 2;
47
+ uint32 empty_timeout = 3;
48
+ uint32 departure_timeout = 14;
49
+ uint32 max_participants = 4;
50
+ int64 creation_time = 5;
51
+ int64 creation_time_ms = 15;
52
+ string turn_password = 6;
53
+ repeated Codec enabled_codecs = 7;
54
+ string metadata = 8 [
55
+ (logger.sensitivity) = SENSITIVITY_PII,
56
+ (logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
57
+ ];
58
+ uint32 num_participants = 9;
59
+ uint32 num_publishers = 11;
60
+ bool active_recording = 10;
61
+ TimedVersion version = 13;
62
+
63
+ // NEXT-ID: 16
64
+ }
65
+
66
+ message Codec {
67
+ string mime = 1;
68
+ string fmtp_line = 2;
69
+ }
70
+
71
+ enum AudioCodec {
72
+ DEFAULT_AC = 0;
73
+ OPUS = 1;
74
+ AAC = 2;
75
+ AC_MP3 = 3;
76
+ }
77
+
78
+ enum VideoCodec {
79
+ DEFAULT_VC = 0;
80
+ H264_BASELINE = 1;
81
+ H264_MAIN = 2;
82
+ H264_HIGH = 3;
83
+ VP8 = 4;
84
+ }
85
+
86
+ enum ImageCodec {
87
+ IC_DEFAULT = 0;
88
+ IC_JPEG = 1;
89
+ }
90
+
91
+ // Policy for publisher to handle subscribers that are unable to support the primary codec of a track
92
+ enum BackupCodecPolicy {
93
+ // default behavior, the track prefer to regress to backup codec and all subscribers will receive the backup codec,
94
+ // the sfu will try to regress codec if possible but not assured.
95
+ PREFER_REGRESSION = 0;
96
+ // encoding/send the primary and backup codec simultaneously
97
+ SIMULCAST = 1;
98
+ // force the track to regress to backup codec, this option can be used in video conference or the publisher has limited bandwidth/encoding power
99
+ REGRESSION = 2;
100
+ }
101
+
102
+ message PlayoutDelay {
103
+ bool enabled = 1;
104
+ uint32 min = 2;
105
+ uint32 max = 3;
106
+ }
107
+
108
+ message ParticipantPermission {
109
+ // allow participant to subscribe to other tracks in the room
110
+ bool can_subscribe = 1;
111
+ // allow participant to publish new tracks to room
112
+ bool can_publish = 2;
113
+ // allow participant to publish data
114
+ bool can_publish_data = 3;
115
+ // sources that are allowed to be published
116
+ repeated TrackSource can_publish_sources = 9;
117
+ // indicates that it's hidden to others
118
+ bool hidden = 7;
119
+ // indicates it's a recorder instance
120
+ // deprecated: use ParticipantInfo.kind instead
121
+ bool recorder = 8 [deprecated = true];
122
+ // indicates that participant can update own metadata and attributes
123
+ bool can_update_metadata = 10;
124
+ // indicates that participant is an agent
125
+ // deprecated: use ParticipantInfo.kind instead
126
+ bool agent = 11 [deprecated = true];
127
+ // if a participant can subscribe to metrics
128
+ bool can_subscribe_metrics = 12;
129
+ // if a participant can manage an agent session via RemoteSession (control and access state)
130
+ bool can_manage_agent_session = 13;
131
+
132
+ // NEXT_ID: 14
133
+ }
134
+
135
+ message ParticipantInfo {
136
+ enum State {
137
+ // websocket' connected, but not offered yet
138
+ JOINING = 0;
139
+ // server received client offer
140
+ JOINED = 1;
141
+ // ICE connectivity established
142
+ ACTIVE = 2;
143
+ // WS disconnected
144
+ DISCONNECTED = 3;
145
+ }
146
+ enum Kind {
147
+ // standard participants, e.g. web clients
148
+ STANDARD = 0;
149
+ // only ingests streams
150
+ INGRESS = 1;
151
+ // only consumes streams
152
+ EGRESS = 2;
153
+ // SIP participants
154
+ SIP = 3;
155
+ // LiveKit agents
156
+ AGENT = 4;
157
+ // Connectors participants
158
+ CONNECTOR = 7;
159
+ // Bridge participants
160
+ BRIDGE = 8;
161
+ // NEXT_ID: 9
162
+ }
163
+ enum KindDetail {
164
+ CLOUD_AGENT = 0;
165
+ FORWARDED = 1;
166
+ CONNECTOR_WHATSAPP = 2;
167
+ CONNECTOR_TWILIO = 3;
168
+ BRIDGE_RTSP = 4;
169
+ SIMULATION = 5;
170
+ // NEXT_ID: 6
171
+ }
172
+ string sid = 1;
173
+ string identity = 2;
174
+ State state = 3;
175
+ repeated TrackInfo tracks = 4;
176
+ string metadata = 5 [
177
+ (logger.sensitivity) = SENSITIVITY_PII,
178
+ (logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
179
+ ];
180
+ // timestamp when participant joined room, in seconds
181
+ int64 joined_at = 6;
182
+ // timestamp when participant joined room, in milliseconds
183
+ int64 joined_at_ms = 17;
184
+ string name = 9 [(logger.sensitivity) = SENSITIVITY_PII];
185
+ uint32 version = 10;
186
+ ParticipantPermission permission = 11;
187
+ string region = 12;
188
+ // indicates the participant has an active publisher connection
189
+ // and can publish to the server
190
+ bool is_publisher = 13;
191
+ Kind kind = 14;
192
+ map<string, string> attributes = 15 [
193
+ (logger.sensitivity) = SENSITIVITY_PII,
194
+ (logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
195
+ ];
196
+ DisconnectReason disconnect_reason = 16;
197
+ repeated KindDetail kind_details = 18;
198
+ repeated DataTrackInfo data_tracks = 19;
199
+
200
+ // protocol version used for client feature compatibility
201
+ int32 client_protocol = 20;
202
+
203
+ // capabilities the participant's client advertises, mirrored from ClientInfo.
204
+ // Lets other participants perform client-side feature detection.
205
+ repeated ClientInfo.Capability capabilities = 21;
206
+
207
+ // NEXT_ID: 22
208
+ }
209
+
210
+ enum TrackType {
211
+ AUDIO = 0;
212
+ VIDEO = 1;
213
+ DATA = 2;
214
+ }
215
+
216
+ enum TrackSource {
217
+ UNKNOWN = 0;
218
+ CAMERA = 1;
219
+ MICROPHONE = 2;
220
+ SCREEN_SHARE = 3;
221
+ SCREEN_SHARE_AUDIO = 4;
222
+ }
223
+
224
+ message Encryption {
225
+ enum Type {
226
+ NONE = 0;
227
+ GCM = 1;
228
+ CUSTOM = 2;
229
+ }
230
+ }
231
+
232
+ message SimulcastCodecInfo {
233
+ string mime_type = 1;
234
+ string mid = 2;
235
+ string cid = 3;
236
+ repeated VideoLayer layers = 4;
237
+ VideoLayer.Mode video_layer_mode = 5;
238
+ // cid (client side id for track) could be different between
239
+ // signalling (AddTrackRequest) and SDP offer. This field
240
+ // will be populated only if it is different to avoid
241
+ // duplication and keep the representation concise.
242
+ string sdp_cid = 6;
243
+ }
244
+
245
+ message TrackInfo {
246
+ string sid = 1;
247
+ TrackType type = 2;
248
+ string name = 3 [(logger.sensitivity) = SENSITIVITY_PII];
249
+ bool muted = 4;
250
+ // original width of video (unset for audio)
251
+ // clients may receive a lower resolution version with simulcast
252
+ uint32 width = 5;
253
+ // original height of video (unset for audio)
254
+ uint32 height = 6;
255
+ // true if track is simulcasted
256
+ bool simulcast = 7 [deprecated = true]; // see `video_layer_mode` in `codecs`
257
+ // true if DTX (Discontinuous Transmission) is disabled for audio
258
+ bool disable_dtx = 8 [deprecated = true]; // deprecated in favor of `audio_features`
259
+ // source of media
260
+ TrackSource source = 9;
261
+ repeated VideoLayer layers = 10 [deprecated = true]; // see `codecs` for layers of individual codec
262
+ // mime type of codec
263
+ string mime_type = 11;
264
+ string mid = 12;
265
+ repeated SimulcastCodecInfo codecs = 13;
266
+ bool stereo = 14 [deprecated = true]; // deprecated in favor of `audio_features`
267
+ // true if RED (Redundant Encoding) is disabled for audio
268
+ bool disable_red = 15;
269
+ Encryption.Type encryption = 16;
270
+ string stream = 17;
271
+ TimedVersion version = 18;
272
+ repeated AudioTrackFeature audio_features = 19;
273
+ BackupCodecPolicy backup_codec_policy = 20;
274
+
275
+ repeated PacketTrailerFeature packet_trailer_features = 21;
276
+ }
277
+
278
+ message DataTrackInfo {
279
+ // Client-assigned, 16-bit identifier that will be attached to packets sent by the publisher.
280
+ uint32 pub_handle = 1;
281
+
282
+ // Server-assigned track identifier.
283
+ string sid = 2;
284
+
285
+ // Human-readable identifier (e.g., `geoLocation`, `servoPosition.x`, etc.), unique per publisher.
286
+ string name = 3;
287
+
288
+ // Method used for end-to-end encryption (E2EE) on packet payloads.
289
+ Encryption.Type encryption = 4;
290
+
291
+ // Encoding for frame payloads on this track. If unspecified, the track is untyped.
292
+ optional DataTrackFrameEncoding frame_encoding = 5;
293
+
294
+ // ID of the schema used by frames on this track if the track is typed.
295
+ optional DataTrackSchemaId schema = 6;
296
+ }
297
+
298
+ // Encoding for frame payloads.
299
+ message DataTrackFrameEncoding {
300
+
301
+ // Well-known encoding for frame payloads.
302
+ //
303
+ // Mirrors the well-known message encodings from the MCAP spec:
304
+ // https://mcap.dev/spec/registry#message-encodings
305
+ //
306
+ enum WellKnownFrameEncoding {
307
+ WELL_KNOWN_FRAME_ENCODING_UNSPECIFIED = 0;
308
+ // ROS 1: must be described by `ROS1_MSG` schema encoding.
309
+ WELL_KNOWN_FRAME_ENCODING_ROS1 = 1;
310
+ // CDR: must be described by `ROS2_MSG`, `ROS2_IDL`, or `OMG_IDL` schema encoding.
311
+ WELL_KNOWN_FRAME_ENCODING_CDR = 2;
312
+ // Protocol Buffer: must be described by `PROTOBUF` schema encoding.
313
+ WELL_KNOWN_FRAME_ENCODING_PROTOBUF = 3;
314
+ // FlatBuffer: must be described by `FLATBUFFER` schema encoding.
315
+ WELL_KNOWN_FRAME_ENCODING_FLATBUFFER = 4;
316
+ // CBOR: self-describing.
317
+ WELL_KNOWN_FRAME_ENCODING_CBOR = 5;
318
+ // MessagePack: self-describing.
319
+ WELL_KNOWN_FRAME_ENCODING_MSGPACK = 6;
320
+ // JSON: self-describing or described by `JSON_SCHEMA` schema encoding.
321
+ WELL_KNOWN_FRAME_ENCODING_JSON = 7;
322
+ }
323
+
324
+ oneof value {
325
+ WellKnownFrameEncoding well_known = 1;
326
+ // Identifier of a custom encoding not covered by the well-known cases.
327
+ // This must be non-empty and no longer than 32 characters.
328
+ string custom = 2;
329
+ }
330
+ }
331
+
332
+ // Encoding for schema definition.
333
+ message DataTrackSchemaEncoding {
334
+ // Well-known encoding for schema definition.
335
+ //
336
+ // Mirrors the well-known schema encodings from the MCAP spec:
337
+ // https://mcap.dev/spec/registry#schema-encodings
338
+ //
339
+ enum WellKnownSchemaEncoding {
340
+ WELL_KNOWN_SCHEMA_ENCODING_UNSPECIFIED = 0;
341
+ // Protocol Buffer IDL: describes `PROTOBUF` frame encoding.
342
+ WELL_KNOWN_SCHEMA_ENCODING_PROTOBUF = 1;
343
+ // FlatBuffer IDL: describes `FLATBUFFER` frame encoding.
344
+ WELL_KNOWN_SCHEMA_ENCODING_FLATBUFFER = 2;
345
+ // ROS 1 Message: describes `ROS1` frame encoding.
346
+ WELL_KNOWN_SCHEMA_ENCODING_ROS1_MSG = 3;
347
+ // ROS 2 Message: describes `CDR` frame encoding.
348
+ WELL_KNOWN_SCHEMA_ENCODING_ROS2_MSG = 4;
349
+ // ROS 2 IDL: describes `CDR` frame encoding.
350
+ WELL_KNOWN_SCHEMA_ENCODING_ROS2_IDL = 5;
351
+ // OMG IDL: describes `CDR` frame encoding.
352
+ WELL_KNOWN_SCHEMA_ENCODING_OMG_IDL = 6;
353
+ // JSON Schema: describes `JSON` frame encoding.
354
+ WELL_KNOWN_SCHEMA_ENCODING_JSON_SCHEMA = 7;
355
+ }
356
+
357
+ oneof value {
358
+ WellKnownSchemaEncoding well_known = 1;
359
+ // Identifier of a custom encoding not covered by the well-known cases.
360
+ // This must be non-empty and no longer than 32 characters.
361
+ string custom = 2;
362
+ }
363
+ }
364
+
365
+ // Identifier for a data track schema.
366
+ //
367
+ // Schemas with the same name but different encodings are distinct.
368
+ //
369
+ message DataTrackSchemaId {
370
+ // This must be non-empty and no longer than 256 characters.
371
+ string name = 1;
372
+ DataTrackSchemaEncoding encoding = 2;
373
+ }
374
+
375
+ enum DataTrackExtensionID {
376
+ DTEI_INVALID = 0;
377
+ DTEI_PARTICIPANT_SID = 1;
378
+ }
379
+
380
+ message DataTrackExtensionParticipantSid {
381
+ DataTrackExtensionID id = 1;
382
+ string participant_sid = 2;
383
+ }
384
+
385
+ message DataTrackSubscriptionOptions {
386
+ // Rate in frames per second (FPS) the subscriber wants to receive frames at.
387
+ // If omitted, the subscriber defaults to the publisher's fps
388
+ optional uint32 target_fps = 1;
389
+ }
390
+
391
+ // Key used to uniquely identify a data blob for storage and retrieval.
392
+ message DataBlobKey {
393
+ oneof key {
394
+ // Generic string key, blob contains arbitrary data.
395
+ string generic = 1;
396
+ // Data track schema identifier, blob contains schema definition.
397
+ DataTrackSchemaId schema_id = 2 [(logger.name) = "schemaID"];
398
+ }
399
+ }
400
+
401
+ // A blob of data stored in a room identified by a unique key.
402
+ message DataBlob {
403
+ // Unique key the data blob is identified by.
404
+ DataBlobKey key = 1;
405
+ // Contents of the data blob. This must not exceed 50 KB.
406
+ bytes contents = 2 [
407
+ (logger.sensitivity) = SENSITIVITY_PII,
408
+ (logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
409
+ ];
410
+ }
411
+
412
+ enum VideoQuality {
413
+ LOW = 0;
414
+ MEDIUM = 1;
415
+ HIGH = 2;
416
+ OFF = 3;
417
+ }
418
+
419
+ // provide information about available spatial layers
420
+ message VideoLayer {
421
+ enum Mode {
422
+ MODE_UNUSED = 0;
423
+ ONE_SPATIAL_LAYER_PER_STREAM = 1;
424
+ MULTIPLE_SPATIAL_LAYERS_PER_STREAM = 2;
425
+ ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR = 3;
426
+ }
427
+
428
+ // for tracks with a single layer, this should be HIGH
429
+ VideoQuality quality = 1;
430
+ uint32 width = 2;
431
+ uint32 height = 3;
432
+ // target bitrate in bit per second (bps), server will measure actual
433
+ uint32 bitrate = 4;
434
+ uint32 ssrc = 5;
435
+ int32 spatial_layer = 6;
436
+ string rid = 7;
437
+
438
+ uint32 repair_ssrc = 8;
439
+ }
440
+
441
+ // new DataPacket API
442
+ message DataPacket {
443
+ enum Kind {
444
+ RELIABLE = 0;
445
+ LOSSY = 1;
446
+ }
447
+ Kind kind = 1 [deprecated = true];
448
+ // participant identity of user that sent the message
449
+ string participant_identity = 4;
450
+ // identities of participants who will receive the message (sent to all by default)
451
+ repeated string destination_identities = 5;
452
+ oneof value {
453
+ UserPacket user = 2;
454
+ ActiveSpeakerUpdate speaker = 3 [deprecated = true];
455
+ SipDTMF sip_dtmf = 6;
456
+ Transcription transcription = 7;
457
+ MetricsBatch metrics = 8;
458
+ ChatMessage chat_message = 9;
459
+ RpcRequest rpc_request = 10;
460
+ RpcAck rpc_ack = 11;
461
+ RpcResponse rpc_response = 12;
462
+ DataStream.Header stream_header = 13;
463
+ DataStream.Chunk stream_chunk = 14;
464
+ DataStream.Trailer stream_trailer = 15;
465
+ EncryptedPacket encrypted_packet = 18;
466
+ }
467
+ // sequence number of reliable packet
468
+ uint32 sequence = 16;
469
+ // sid of the user that sent the message
470
+ string participant_sid = 17;
471
+
472
+ // NEXT_ID: 19
473
+ }
474
+
475
+ message EncryptedPacket {
476
+ Encryption.Type encryption_type = 1;
477
+ bytes iv = 2;
478
+ uint32 key_index = 3;
479
+ bytes encrypted_value = 4; // This is an encrypted EncryptedPacketPayload message representation
480
+ }
481
+
482
+ message EncryptedPacketPayload {
483
+ oneof value {
484
+ UserPacket user = 1;
485
+ ChatMessage chat_message = 3;
486
+ RpcRequest rpc_request = 4;
487
+ RpcAck rpc_ack = 5;
488
+ RpcResponse rpc_response = 6;
489
+ DataStream.Header stream_header = 7;
490
+ DataStream.Chunk stream_chunk = 8;
491
+ DataStream.Trailer stream_trailer = 9;
492
+
493
+ // NEXT_ID: 10
494
+ }
495
+ }
496
+
497
+ message ActiveSpeakerUpdate {
498
+ option deprecated = true;
499
+ repeated SpeakerInfo speakers = 1;
500
+ }
501
+
502
+ message SpeakerInfo {
503
+ string sid = 1;
504
+ // audio level, 0-1.0, 1 is loudest
505
+ float level = 2;
506
+ // true if speaker is currently active
507
+ bool active = 3;
508
+ }
509
+
510
+ message UserPacket {
511
+ // participant ID of user that sent the message
512
+ string participant_sid = 1 [deprecated = true];
513
+ string participant_identity = 5 [deprecated = true];
514
+ // user defined payload
515
+ bytes payload = 2;
516
+ // the ID of the participants who will receive the message (sent to all by default)
517
+ repeated string destination_sids = 3 [deprecated = true];
518
+ // identities of participants who will receive the message (sent to all by default)
519
+ repeated string destination_identities = 6 [deprecated = true];
520
+ // topic under which the message was published
521
+ optional string topic = 4;
522
+ // Unique ID to identify the message
523
+ optional string id = 8;
524
+ // start and end time allow relating the message to specific media time
525
+ optional uint64 start_time = 9;
526
+ optional uint64 end_time = 10;
527
+ // added by SDK to enable de-duping of messages, for INTERNAL USE ONLY
528
+ bytes nonce = 11;
529
+
530
+ // NEXT_ID: 12
531
+ }
532
+
533
+ message SipDTMF {
534
+ uint32 code = 3;
535
+ string digit = 4;
536
+ }
537
+
538
+ message Transcription {
539
+ // Participant that got its speech transcribed
540
+ string transcribed_participant_identity = 2;
541
+ string track_id = 3 [(logger.name) = "trackID"];
542
+ repeated TranscriptionSegment segments = 4;
543
+
544
+ // NEXT_ID: 6
545
+ }
546
+
547
+ message TranscriptionSegment {
548
+ string id = 1;
549
+ string text = 2;
550
+ uint64 start_time = 3;
551
+ uint64 end_time = 4;
552
+ bool final = 5;
553
+ string language = 6;
554
+ }
555
+
556
+ message ChatMessage {
557
+ string id = 1; // uuid
558
+ int64 timestamp = 2;
559
+ optional int64 edit_timestamp = 3; // populated only if the intent is to edit/update an existing message
560
+ string message = 4;
561
+ bool deleted = 5; // true to remove message
562
+ bool generated = 6; // true if the chat message has been generated by an agent from a participant's audio transcription
563
+ }
564
+
565
+ message RpcRequest {
566
+ string id = 1;
567
+ string method = 2;
568
+ string payload = 3;
569
+ uint32 response_timeout_ms = 4;
570
+ uint32 version = 5;
571
+ // Compressed payload data. When set, this field is used instead of `payload`.
572
+ bytes compressed_payload = 6;
573
+ }
574
+
575
+ message RpcAck {
576
+ string request_id = 1 [(logger.name) = "requestID"];
577
+ }
578
+
579
+ message RpcResponse {
580
+ string request_id = 1 [(logger.name) = "requestID"];
581
+ oneof value {
582
+ string payload = 2;
583
+ RpcError error = 3;
584
+ // Compressed payload data. When set, this field is used instead of `payload`.
585
+ bytes compressed_payload = 4;
586
+ }
587
+ }
588
+
589
+ message RpcError {
590
+ uint32 code = 1;
591
+ string message = 2;
592
+ string data = 3;
593
+ }
594
+
595
+ enum ConnectionQuality {
596
+ POOR = 0;
597
+ GOOD = 1;
598
+ EXCELLENT = 2;
599
+ LOST = 3;
600
+ }
601
+
602
+ message ParticipantTracks {
603
+ // participant ID of participant to whom the tracks belong
604
+ string participant_sid = 1;
605
+ repeated string track_sids = 2;
606
+ }
607
+
608
+ // details about the server
609
+ message ServerInfo {
610
+ enum Edition {
611
+ Standard = 0;
612
+ Cloud = 1;
613
+ }
614
+ Edition edition = 1;
615
+ string version = 2;
616
+ int32 protocol = 3;
617
+ string region = 4;
618
+ string node_id = 5 [(logger.name) = "nodeID"];
619
+ // additional debugging information. sent only if server is in development mode
620
+ string debug_info = 6;
621
+ int32 agent_protocol = 7;
622
+ }
623
+
624
+ // details about the client
625
+ message ClientInfo {
626
+ enum SDK {
627
+ UNKNOWN = 0;
628
+ JS = 1;
629
+ SWIFT = 2;
630
+ ANDROID = 3;
631
+ FLUTTER = 4;
632
+ GO = 5;
633
+ UNITY = 6;
634
+ REACT_NATIVE = 7;
635
+ RUST = 8;
636
+ PYTHON = 9;
637
+ CPP = 10;
638
+ UNITY_WEB = 11;
639
+ NODE = 12;
640
+ UNREAL = 13;
641
+ ESP32 = 14;
642
+ }
643
+
644
+ // Optional capabilities advertised by the client at connect time. The SFU
645
+ // uses these flags to decide whether to enable features that require
646
+ // client-side support (e.g. passing RTP packet trailers through to the
647
+ // subscriber instead of stripping them).
648
+ enum Capability {
649
+ CAP_UNUSED = 0;
650
+ CAP_PACKET_TRAILER = 1;
651
+ CAP_COMPRESSION_DEFLATE_RAW = 2;
652
+ }
653
+
654
+ SDK sdk = 1;
655
+ string version = 2;
656
+ int32 protocol = 3;
657
+ string os = 4;
658
+ string os_version = 5;
659
+ string device_model = 6;
660
+ string browser = 7;
661
+ string browser_version = 8;
662
+ string address = 9;
663
+ // wifi, wired, cellular, vpn, empty if not known
664
+ string network = 10;
665
+ // comma separated list of additional LiveKit SDKs in use of this client, with versions
666
+ // e.g. "components-js:1.2.3,track-processors-js:1.2.3"
667
+ string other_sdks = 11;
668
+ // client protocol version
669
+ int32 client_protocol = 12;
670
+ // capabilities the client advertises. Populated automatically by each SDK;
671
+ // not a user-configurable setting.
672
+ repeated Capability capabilities = 13;
673
+ }
674
+
675
+ // server provided client configuration
676
+ message ClientConfiguration {
677
+ VideoConfiguration video = 1;
678
+ VideoConfiguration screen = 2;
679
+
680
+ ClientConfigSetting resume_connection = 3;
681
+ DisabledCodecs disabled_codecs = 4;
682
+ ClientConfigSetting force_relay = 5;
683
+ }
684
+
685
+ enum ClientConfigSetting {
686
+ UNSET = 0;
687
+ DISABLED = 1;
688
+ ENABLED = 2;
689
+ }
690
+
691
+ message VideoConfiguration {
692
+ ClientConfigSetting hardware_encoder = 1;
693
+ }
694
+
695
+ message DisabledCodecs {
696
+ // disabled for both publish and subscribe
697
+ repeated Codec codecs = 1;
698
+ // only disable for publish
699
+ repeated Codec publish = 2;
700
+ }
701
+
702
+ enum DisconnectReason {
703
+ UNKNOWN_REASON = 0;
704
+ // the client initiated the disconnect
705
+ CLIENT_INITIATED = 1;
706
+ // another participant with the same identity has joined the room
707
+ DUPLICATE_IDENTITY = 2;
708
+ // the server instance is shutting down
709
+ SERVER_SHUTDOWN = 3;
710
+ // RoomService.RemoveParticipant was called
711
+ PARTICIPANT_REMOVED = 4;
712
+ // RoomService.DeleteRoom was called
713
+ ROOM_DELETED = 5;
714
+ // the client is attempting to resume a session, but server is not aware of it
715
+ STATE_MISMATCH = 6;
716
+ // client was unable to connect fully
717
+ JOIN_FAILURE = 7;
718
+ // Cloud-only, the server requested Participant to migrate the connection elsewhere
719
+ MIGRATION = 8;
720
+ // the signal websocket was closed unexpectedly
721
+ SIGNAL_CLOSE = 9;
722
+ // the room was closed, due to all Standard and Ingress participants having left
723
+ ROOM_CLOSED = 10;
724
+ // SIP callee did not respond in time
725
+ USER_UNAVAILABLE = 11;
726
+ // SIP callee rejected the call (busy)
727
+ USER_REJECTED = 12;
728
+ // SIP protocol failure or unexpected response
729
+ SIP_TRUNK_FAILURE = 13;
730
+ // server timed out a participant session
731
+ CONNECTION_TIMEOUT = 14;
732
+ // media stream failure or media timeout
733
+ MEDIA_FAILURE = 15;
734
+ // agent encountered an error
735
+ AGENT_ERROR = 16;
736
+ }
737
+
738
+ // why a room ended, reported on room-ended telemetry
739
+ enum RoomEndReason {
740
+ ROOM_END_UNKNOWN = 0;
741
+ // RoomService.DeleteRoom was called
742
+ ROOM_END_API_DELETE = 1;
743
+ // the room sat empty past its empty or departure timeout
744
+ ROOM_END_IDLE_TIMEOUT = 2;
745
+ // the server instance is shutting down
746
+ ROOM_END_SERVER_SHUTDOWN = 3;
747
+ // the room was restarted or replaced elsewhere
748
+ ROOM_END_SUPERSEDED = 4;
749
+ // the room failed to finish opening
750
+ ROOM_END_OPEN_FAILED = 5;
751
+ }
752
+
753
+ message RTPDrift {
754
+ google.protobuf.Timestamp start_time = 1;
755
+ google.protobuf.Timestamp end_time = 2;
756
+ double duration = 3;
757
+
758
+ uint64 start_timestamp = 4;
759
+ uint64 end_timestamp = 5;
760
+ uint64 rtp_clock_ticks = 6;
761
+ int64 drift_samples = 7;
762
+ double drift_ms = 8;
763
+ double clock_rate = 9;
764
+ }
765
+
766
+ message RTPStats {
767
+ google.protobuf.Timestamp start_time = 1;
768
+ google.protobuf.Timestamp end_time = 2;
769
+ double duration = 3;
770
+
771
+ uint32 packets = 4;
772
+ double packet_rate = 5;
773
+
774
+ uint64 bytes = 6;
775
+ uint64 header_bytes = 39;
776
+ double bitrate = 7;
777
+
778
+ uint32 packets_lost = 8;
779
+ double packet_loss_rate = 9;
780
+ float packet_loss_percentage = 10;
781
+
782
+ uint32 packets_duplicate = 11;
783
+ double packet_duplicate_rate = 12;
784
+
785
+ uint64 bytes_duplicate = 13;
786
+ uint64 header_bytes_duplicate = 40;
787
+ double bitrate_duplicate = 14;
788
+
789
+ uint32 packets_padding = 15;
790
+ double packet_padding_rate = 16;
791
+
792
+ uint64 bytes_padding = 17;
793
+ uint64 header_bytes_padding = 41;
794
+ double bitrate_padding = 18;
795
+
796
+ uint32 packets_out_of_order = 19;
797
+
798
+ uint32 frames = 20;
799
+ double frame_rate = 21;
800
+
801
+ double jitter_current = 22;
802
+ double jitter_max = 23;
803
+
804
+ map<int32, uint32> gap_histogram = 24;
805
+
806
+ uint32 nacks = 25;
807
+ uint32 nack_acks = 37;
808
+ uint32 nack_misses = 26;
809
+ uint32 nack_repeated = 38;
810
+
811
+ uint32 plis = 27;
812
+ google.protobuf.Timestamp last_pli = 28;
813
+
814
+ uint32 firs = 29;
815
+ google.protobuf.Timestamp last_fir = 30;
816
+
817
+ uint32 rtt_current = 31;
818
+ uint32 rtt_max = 32;
819
+
820
+ uint32 key_frames = 33;
821
+ google.protobuf.Timestamp last_key_frame = 34;
822
+
823
+ uint32 layer_lock_plis = 35;
824
+ google.protobuf.Timestamp last_layer_lock_pli = 36;
825
+
826
+ RTPDrift packet_drift = 44;
827
+ RTPDrift ntp_report_drift = 45;
828
+ RTPDrift rebased_report_drift = 46;
829
+ RTPDrift received_report_drift = 47;
830
+ // NEXT_ID: 48
831
+ }
832
+
833
+ message RTCPSenderReportState {
834
+ uint32 rtp_timestamp = 1;
835
+ uint64 rtp_timestamp_ext = 2;
836
+ uint64 ntp_timestamp = 3;
837
+ int64 at = 4; // time at which this happened
838
+ int64 at_adjusted = 5;
839
+ uint32 packets = 6;
840
+ uint64 octets = 7;
841
+ }
842
+
843
+ message RTPForwarderState {
844
+ bool started = 1;
845
+ int32 reference_layer_spatial = 2;
846
+ int64 pre_start_time = 3;
847
+ uint64 ext_first_timestamp = 4;
848
+ uint64 dummy_start_timestamp_offset = 5;
849
+ RTPMungerState rtp_munger = 6;
850
+ oneof codec_munger {
851
+ VP8MungerState vp8_munger = 7;
852
+ }
853
+ repeated RTCPSenderReportState sender_report_state = 8;
854
+ }
855
+
856
+ message RTPMungerState {
857
+ uint64 ext_last_sequence_number = 1;
858
+ uint64 ext_second_last_sequence_number = 2;
859
+ uint64 ext_last_timestamp = 3;
860
+ uint64 ext_second_last_timestamp = 4;
861
+ bool last_marker = 5;
862
+ bool second_last_marker = 6;
863
+ }
864
+
865
+ message VP8MungerState {
866
+ int32 ext_last_picture_id = 1 [(logger.name) = "extLastPictureID"];
867
+ bool picture_id_used = 2;
868
+ uint32 last_tl0_pic_idx = 3;
869
+ bool tl0_pic_idx_used = 4;
870
+ bool tid_used = 5;
871
+ uint32 last_key_idx = 6;
872
+ bool key_idx_used = 7;
873
+ }
874
+
875
+ message TimedVersion {
876
+ int64 unix_micro = 1;
877
+ int32 ticks = 2;
878
+ }
879
+
880
+ enum ReconnectReason {
881
+ RR_UNKNOWN = 0;
882
+ RR_SIGNAL_DISCONNECTED = 1;
883
+ RR_PUBLISHER_FAILED = 2;
884
+ RR_SUBSCRIBER_FAILED = 3;
885
+ RR_SWITCH_CANDIDATE = 4;
886
+ }
887
+
888
+ enum SubscriptionError {
889
+ SE_UNKNOWN = 0;
890
+ SE_CODEC_UNSUPPORTED = 1;
891
+ SE_TRACK_NOTFOUND = 2;
892
+ }
893
+
894
+ enum AudioTrackFeature {
895
+ TF_STEREO = 0;
896
+ TF_NO_DTX = 1;
897
+ TF_AUTO_GAIN_CONTROL = 2;
898
+ TF_ECHO_CANCELLATION = 3;
899
+ TF_NOISE_SUPPRESSION = 4;
900
+ TF_ENHANCED_NOISE_CANCELLATION = 5;
901
+ TF_PRECONNECT_BUFFER = 6; // client will buffer audio once available and send it to the server via bytes stream once connected
902
+ }
903
+
904
+ enum PacketTrailerFeature {
905
+ PTF_USER_TIMESTAMP = 0;
906
+ PTF_FRAME_ID = 1;
907
+ PTF_USER_DATA = 2;
908
+ }
909
+
910
+ message DataStream {
911
+ // enum for operation types (specific to TextHeader)
912
+ enum OperationType {
913
+ CREATE = 0;
914
+ UPDATE = 1;
915
+ DELETE = 2;
916
+ REACTION = 3;
917
+ }
918
+
919
+ // header properties specific to text streams
920
+ message TextHeader {
921
+ OperationType operation_type = 1;
922
+ int32 version = 2; // Optional: Version for updates/edits
923
+ string reply_to_stream_id = 3 [(logger.name) = "replyToStreamID"]; // Optional: Reply to specific message
924
+ repeated string attached_stream_ids = 4; // file attachments for text streams
925
+ bool generated = 5; // true if the text has been generated by an agent from a participant's audio transcription
926
+ }
927
+
928
+ // header properties specific to byte or file streams
929
+ message ByteHeader {
930
+ string name = 1;
931
+ }
932
+
933
+ // The compression type of the whole data stream
934
+ //
935
+ // This will only get populated when send to participants with a
936
+ // client protocol >= 2 which advertise a client capability of CAP_COMPRESSION_DEFLATE_RAW
937
+ enum CompressionType {
938
+ NONE = 0;
939
+ DEFLATE_RAW = 1; // DEFLATE_RAW = DEFLATE without header+checksum/trailer
940
+ }
941
+
942
+ // main DataStream.Header that contains a oneof for specific headers
943
+ message Header {
944
+ string stream_id = 1 [(logger.name) = "streamID"]; // unique identifier for this data stream
945
+ int64 timestamp = 2; // using int64 for Unix timestamp
946
+ string topic = 3;
947
+ string mime_type = 4;
948
+ optional uint64 total_length = 5; // only populated for finite streams, if it's a stream of unknown size this stays empty
949
+ Encryption.Type encryption_type = 7 [deprecated = true]; // this is set on the DataPacket
950
+ map<string, string> attributes = 8; // user defined attributes map that can carry additional info
951
+
952
+ // oneof to choose between specific header types
953
+ oneof content_header {
954
+ TextHeader text_header = 9;
955
+ ByteHeader byte_header = 10;
956
+ }
957
+
958
+ // Optional inline content so that a data stream can be sent as a single packet for short payloads.
959
+ optional bytes inline_content = 11; // content as binary (bytes)
960
+ CompressionType compression = 12;
961
+ }
962
+
963
+ message Chunk {
964
+ string stream_id = 1 [(logger.name) = "streamID"]; // unique identifier for this data stream to map it to the correct header
965
+ uint64 chunk_index = 2;
966
+ bytes content = 3; // content as binary (bytes)
967
+ int32 version = 4; // a version indicating that this chunk_index has been retroactively modified and the original one needs to be replaced
968
+ optional bytes iv = 5 [deprecated = true]; // this is set on the DataPacket
969
+ }
970
+
971
+ message Trailer {
972
+ string stream_id = 1 [(logger.name) = "streamID"]; // unique identifier for this data stream
973
+ string reason = 2; // reason why the stream was closed (could contain "error" / "interrupted" / empty for expected end)
974
+ map<string, string> attributes = 3; // finalizing updates for the stream, can also include additional insights for errors or endTime for transcription
975
+ }
976
+ }
977
+
978
+ message FilterParams {
979
+ repeated string include_events = 1;
980
+ repeated string exclude_events = 2;
981
+ }
982
+
983
+ message WebhookConfig {
984
+ string url = 1;
985
+ string signing_key = 2;
986
+ FilterParams filter_params = 3;
987
+ }
988
+
989
+ message SubscribedAudioCodec {
990
+ string codec = 1;
991
+ bool enabled = 2;
992
+ }