fork/rust-sdks
git clone https://git.julia.blue/fork/rust-sdks
2c627f5
main
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 15syntax = "proto2" ; 16 17package livekit . proto ; 18option csharp_namespace= "LiveKit.Proto" ; 19 20import "e2ee.proto" ; 21import "handle.proto" ; 22import "participant.proto" ; 23import "track.proto" ; 24import "video_frame.proto" ; 25import "stats.proto" ; 26 27// Connect to a new LiveKit room 28message ConnectRequest { 29required string url = 1 ; 30required string token = 2 ; 31required RoomOptions options = 3 ; 32} 33message ConnectResponse { 34required uint64 async_id = 1 ; 35} 36message ConnectCallback { 37message ParticipantWithTracks { 38required OwnedParticipant participant = 1 ; 39 40// TrackInfo are not needed here, if we're subscribed to a track, the FfiServer will send 41// a TrackSubscribed event 42repeated OwnedTrackPublication publications = 2 ; 43} 44 45message Result { 46required OwnedRoom room = 1 ; 47required OwnedParticipant local_participant = 2 ; 48repeated ParticipantWithTracks participants = 3 ; 49} 50 51required uint64 async_id = 1 ; 52oneof message { 53string error = 2 ; 54Result result = 3 ; 55} 56 57} 58 59// Disconnect from the a room 60message DisconnectRequest { required uint64 room_handle = 1 ; } 61message DisconnectResponse { required uint64 async_id = 1 ; } 62message DisconnectCallback { required uint64 async_id = 1 ; } 63 64// Publish a track to the room 65message PublishTrackRequest { 66required uint64 local_participant_handle = 1 ; 67required uint64 track_handle = 2 ; 68required TrackPublishOptions options = 3 ; 69} 70message PublishTrackResponse { 71required uint64 async_id = 1 ; 72} 73message PublishTrackCallback { 74required uint64 async_id = 1 ; 75oneof message { 76string error = 2 ; 77OwnedTrackPublication publication = 3 ; 78} 79 80} 81 82// Unpublish a track from the room 83message UnpublishTrackRequest { 84required uint64 local_participant_handle = 1 ; 85required string track_sid = 2 ; 86required bool stop_on_unpublish = 3 ; 87} 88message UnpublishTrackResponse { 89required uint64 async_id = 1 ; 90} 91message UnpublishTrackCallback { 92required uint64 async_id = 1 ; 93optional string error = 2 ; 94} 95 96// Publish data to other participants 97message PublishDataRequest { 98required uint64 local_participant_handle = 1 ; 99required uint64 data_ptr = 2 ; 100required uint64 data_len = 3 ; 101required bool reliable = 4 ; 102repeated string destination_sids = 5 [ deprecated = true ]; 103optional string topic = 6 ; 104repeated string destination_identities = 7 ; 105} 106message PublishDataResponse { 107required uint64 async_id = 1 ; 108} 109message PublishDataCallback { 110required uint64 async_id = 1 ; 111optional string error = 2 ; 112} 113 114// Publish transcription messages to room 115message PublishTranscriptionRequest { 116required uint64 local_participant_handle = 1 ; 117required string participant_identity = 2 ; 118required string track_id = 3 ; 119repeated TranscriptionSegment segments = 4 ; 120} 121message PublishTranscriptionResponse { 122required uint64 async_id = 1 ; 123} 124message PublishTranscriptionCallback { 125required uint64 async_id = 1 ; 126optional string error = 2 ; 127} 128 129// Publish Sip DTMF messages to other participants 130message PublishSipDtmfRequest { 131required uint64 local_participant_handle = 1 ; 132required uint32 code = 2 ; 133required string digit = 3 ; 134repeated string destination_identities = 4 ; 135} 136message PublishSipDtmfResponse { 137required uint64 async_id = 1 ; 138} 139message PublishSipDtmfCallback { 140required uint64 async_id = 1 ; 141optional string error = 2 ; 142} 143 144// Change the local participant's metadata 145message SetLocalMetadataRequest { 146required uint64 local_participant_handle = 1 ; 147required string metadata = 2 ; 148} 149message SetLocalMetadataResponse { 150required uint64 async_id = 1 ; 151} 152message SetLocalMetadataCallback { 153required uint64 async_id = 1 ; 154optional string error = 2 ; 155} 156 157message SendChatMessageRequest { 158required uint64 local_participant_handle = 1 ; 159required string message = 2 ; 160repeated string destination_identities = 3 ; 161optional string sender_identity = 4 ; 162} 163message EditChatMessageRequest { 164required uint64 local_participant_handle = 1 ; 165required string edit_text = 2 ; 166required ChatMessage original_message = 3 ; 167repeated string destination_identities = 4 ; 168optional string sender_identity = 5 ; 169} 170message SendChatMessageResponse { 171required uint64 async_id = 1 ; 172} 173message SendChatMessageCallback { 174required uint64 async_id = 1 ; 175oneof message { 176string error = 2 ; 177ChatMessage chat_message = 3 ; 178} 179} 180 181// Change the local participant's attributes 182message SetLocalAttributesRequest { 183required uint64 local_participant_handle = 1 ; 184repeated AttributesEntry attributes = 2 ; 185} 186 187message AttributesEntry { 188required string key = 1 ; 189required string value = 2 ; 190} 191 192message SetLocalAttributesResponse { 193required uint64 async_id = 1 ; 194} 195message SetLocalAttributesCallback { 196required uint64 async_id = 1 ; 197optional string error = 2 ; 198} 199 200// Change the local participant's name 201message SetLocalNameRequest { 202required uint64 local_participant_handle = 1 ; 203required string name = 2 ; 204} 205message SetLocalNameResponse { 206required uint64 async_id = 1 ; 207} 208message SetLocalNameCallback { 209required uint64 async_id = 1 ; 210optional string error = 2 ; 211} 212 213// Change the "desire" to subs2ribe to a track 214message SetSubscribedRequest { 215required bool subscribe = 1 ; 216required uint64 publication_handle = 2 ; 217} 218message SetSubscribedResponse {} 219 220message GetSessionStatsRequest { 221required uint64 room_handle = 1 ; 222} 223message GetSessionStatsResponse { 224required uint64 async_id = 1 ; 225} 226message GetSessionStatsCallback { 227message Result { 228repeated RtcStats publisher_stats = 1 ; 229repeated RtcStats subscriber_stats = 2 ; 230} 231 232required uint64 async_id = 1 ; 233 234oneof message { 235string error = 2 ; 236Result result = 3 ; 237} 238} 239 240// 241// Options 242// 243 244message VideoEncoding { 245required uint64 max_bitrate = 1 ; 246required double max_framerate = 2 ; 247} 248 249message AudioEncoding { 250required uint64 max_bitrate = 1 ; 251} 252 253message TrackPublishOptions { 254// encodings are optional 255optional VideoEncoding video_encoding = 1 ; 256optional AudioEncoding audio_encoding = 2 ; 257optional VideoCodec video_codec = 3 ; 258optional bool dtx = 4 ; 259optional bool red = 5 ; 260optional bool simulcast = 6 ; 261optional TrackSource source = 7 ; 262optional string stream = 8 ; 263} 264 265enum IceTransportType { 266TRANSPORT_RELAY = 0 ; 267TRANSPORT_NOHOST = 1 ; 268TRANSPORT_ALL = 2 ; 269} 270 271enum ContinualGatheringPolicy { 272GATHER_ONCE = 0 ; 273GATHER_CONTINUALLY = 1 ; 274} 275 276message IceServer { 277repeated string urls = 1 ; 278optional string username = 2 ; 279optional string password = 3 ; 280} 281 282message RtcConfig { 283optional IceTransportType ice_transport_type = 1 ; 284optional ContinualGatheringPolicy continual_gathering_policy = 2 ; 285repeated IceServer ice_servers = 3 ; // empty fallback to default 286} 287 288message RoomOptions { 289optional bool auto_subscribe = 1 ; 290optional bool adaptive_stream = 2 ; 291optional bool dynacast = 3 ; 292optional E2eeOptions e2ee = 4 ; 293optional RtcConfig rtc_config = 5 ; // allow to setup a custom RtcConfiguration 294optional uint32 join_retries = 6 ; 295} 296 297// 298// Room 299// 300 301enum ConnectionQuality { 302QUALITY_POOR = 0 ; 303QUALITY_GOOD = 1 ; 304QUALITY_EXCELLENT = 2 ; 305QUALITY_LOST = 3 ; 306} 307 308enum ConnectionState { 309CONN_DISCONNECTED = 0 ; 310CONN_CONNECTED = 1 ; 311CONN_RECONNECTING = 2 ; 312} 313 314enum DataPacketKind { 315KIND_LOSSY = 0 ; 316KIND_RELIABLE = 1 ; 317} 318 319message TranscriptionSegment { 320required string id = 1 ; 321required string text = 2 ; 322required uint64 start_time = 3 ; 323required uint64 end_time = 4 ; 324required bool final = 5 ; 325required string language = 6 ; 326} 327 328message BufferInfo { 329required uint64 data_ptr = 1 ; 330required uint64 data_len = 2 ; 331} 332 333message OwnedBuffer { 334required FfiOwnedHandle handle = 1 ; 335required BufferInfo data = 2 ; 336} 337 338message RoomEvent { 339required uint64 room_handle = 1 ; 340oneof message { 341ParticipantConnected participant_connected = 2 ; 342ParticipantDisconnected participant_disconnected = 3 ; 343LocalTrackPublished local_track_published = 4 ; 344LocalTrackUnpublished local_track_unpublished = 5 ; 345LocalTrackSubscribed local_track_subscribed = 6 ; 346TrackPublished track_published = 7 ; 347TrackUnpublished track_unpublished = 8 ; 348TrackSubscribed track_subscribed = 9 ; 349TrackUnsubscribed track_unsubscribed = 10 ; 350TrackSubscriptionFailed track_subscription_failed = 11 ; 351TrackMuted track_muted = 12 ; 352TrackUnmuted track_unmuted = 13 ; 353ActiveSpeakersChanged active_speakers_changed = 14 ; 354RoomMetadataChanged room_metadata_changed = 15 ; 355RoomSidChanged room_sid_changed = 16 ; 356ParticipantMetadataChanged participant_metadata_changed = 17 ; 357ParticipantNameChanged participant_name_changed = 18 ; 358ParticipantAttributesChanged participant_attributes_changed = 19 ; 359ConnectionQualityChanged connection_quality_changed = 20 ; 360ConnectionStateChanged connection_state_changed = 21 ; 361// Connected connected = 21; 362Disconnected disconnected = 22 ; 363Reconnecting reconnecting = 23 ; 364Reconnected reconnected = 24 ; 365E2eeStateChanged e2ee_state_changed = 25 ; 366RoomEOS eos = 26 ; // The stream of room events has ended 367DataPacketReceived data_packet_received = 27 ; 368TranscriptionReceived transcription_received = 28 ; 369ChatMessageReceived chat_message = 29 ; 370DataStreamHeaderReceived stream_header_received = 30 ; 371DataStreamChunkReceived stream_chunk_received = 31 ; 372DataStreamTrailerReceived stream_trailer_received = 32 ; 373DataChannelBufferedAmountLowThresholdChanged data_channel_low_threshold_changed = 33 ; 374} 375} 376 377message RoomInfo { 378optional string sid = 1 ; 379required string name = 2 ; 380required string metadata = 3 ; 381required uint64 lossy_dc_buffered_amount_low_threshold = 4 ; 382required uint64 reliable_dc_buffered_amount_low_threshold = 5 ; 383} 384 385message OwnedRoom { 386required FfiOwnedHandle handle = 1 ; 387required RoomInfo info = 2 ; 388} 389 390message ParticipantConnected { required OwnedParticipant info = 1 ; } 391 392message ParticipantDisconnected { 393required string participant_identity = 1 ; 394required DisconnectReason disconnect_reason = 2 ; 395} 396 397message LocalTrackPublished { 398// The TrackPublicationInfo comes from the PublishTrack response 399// and the FfiClient musts wait for it before firing this event 400required string track_sid = 1 ; 401} 402 403message LocalTrackUnpublished { 404required string publication_sid = 1 ; 405} 406 407message LocalTrackSubscribed { 408required string track_sid = 2 ; 409} 410 411message TrackPublished { 412required string participant_identity = 1 ; 413required OwnedTrackPublication publication = 2 ; 414} 415 416message TrackUnpublished { 417required string participant_identity = 1 ; 418required string publication_sid = 2 ; 419} 420 421// Publication isn't needed for subscription events on the FFI 422// The FFI will retrieve the publication using the Track sid 423message TrackSubscribed { 424required string participant_identity = 1 ; 425required OwnedTrack track = 2 ; 426} 427 428message TrackUnsubscribed { 429// The FFI language can dispose/remove the VideoSink here 430required string participant_identity = 1 ; 431required string track_sid = 2 ; 432} 433 434message TrackSubscriptionFailed { 435required string participant_identity = 1 ; 436required string track_sid = 2 ; 437required string error = 3 ; 438} 439 440message TrackMuted { 441required string participant_identity = 1 ; 442required string track_sid = 2 ; 443} 444 445message TrackUnmuted { 446required string participant_identity = 1 ; 447required string track_sid = 2 ; 448} 449 450message E2eeStateChanged { 451required string participant_identity = 1 ; // Using sid instead of identity for ffi communication 452required EncryptionState state = 2 ; 453} 454 455message ActiveSpeakersChanged { repeated string participant_identities = 1 ; } 456 457message RoomMetadataChanged { 458required string metadata = 1 ; 459} 460 461message RoomSidChanged { 462required string sid = 1 ; 463} 464 465message ParticipantMetadataChanged { 466required string participant_identity = 1 ; 467required string metadata = 2 ; 468} 469 470message ParticipantAttributesChanged { 471required string participant_identity = 1 ; 472repeated AttributesEntry attributes = 2 ; 473repeated AttributesEntry changed_attributes = 3 ; 474} 475 476message ParticipantNameChanged { 477required string participant_identity = 1 ; 478required string name = 2 ; 479} 480 481message ConnectionQualityChanged { 482required string participant_identity = 1 ; 483required ConnectionQuality quality = 2 ; 484} 485 486message UserPacket { 487required OwnedBuffer data = 1 ; 488optional string topic = 2 ; 489} 490 491message ChatMessage { 492required string id = 1 ; 493required int64 timestamp = 2 ; 494required string message = 3 ; 495optional int64 edit_timestamp = 4 ; 496optional bool deleted = 5 ; 497optional bool generated = 6 ; 498} 499 500message ChatMessageReceived { 501required ChatMessage message = 1 ; 502required string participant_identity = 2 ; 503} 504 505message SipDTMF { 506required uint32 code = 1 ; 507optional string digit = 2 ; 508} 509 510message DataPacketReceived { 511required DataPacketKind kind = 1 ; 512required string participant_identity = 2 ; // Can be empty if the data is sent a server SDK 513oneof value { 514UserPacket user = 4 ; 515SipDTMF sip_dtmf = 5 ; 516} 517} 518 519message TranscriptionReceived { 520optional string participant_identity = 1 ; 521optional string track_sid = 2 ; 522repeated TranscriptionSegment segments = 3 ; 523} 524 525message ConnectionStateChanged { required ConnectionState state = 1 ; } 526 527message Connected {} 528message Disconnected { 529required DisconnectReason reason = 1 ; 530} 531message Reconnecting {} 532message Reconnected {} 533 534message RoomEOS {} 535 536message DataStream { 537 538// enum for operation types (specific to TextHeader) 539enum OperationType { 540CREATE = 0 ; 541UPDATE = 1 ; 542DELETE = 2 ; 543REACTION = 3 ; 544} 545 546// header properties specific to text streams 547message TextHeader { 548required OperationType operation_type = 1 ; 549optional int32 version = 2 ; // Optional: Version for updates/edits 550optional string reply_to_stream_id = 3 ; // Optional: Reply to specific message 551repeated string attached_stream_ids = 4 ; // file attachments for text streams 552optional bool generated = 5 ; // true if the text has been generated by an agent from a participant's audio transcription 553 554} 555 556// header properties specific to byte or file streams 557message ByteHeader { 558required string name = 1 ; 559} 560 561// main DataStream.Header that contains a oneof for specific headers 562message Header { 563required string stream_id = 1 ; // unique identifier for this data stream 564required int64 timestamp = 2 ; // using int64 for Unix timestamp 565required string mime_type = 3 ; 566required string topic = 4 ; 567optional uint64 total_length = 5 ; // only populated for finite streams, if it's a stream of unknown size this stays empty 568map < string , string > attributes = 6 ; // user defined attributes map that can carry additional info 569 570// oneof to choose between specific header types 571oneof content_header { 572TextHeader text_header = 7 ; 573ByteHeader byte_header = 8 ; 574} 575} 576 577message Chunk { 578required string stream_id = 1 ; // unique identifier for this data stream to map it to the correct header 579required uint64 chunk_index = 2 ; 580required bytes content = 3 ; // content as binary (bytes) 581optional int32 version = 4 ; // a version indicating that this chunk_index has been retroactively modified and the original one needs to be replaced 582optional bytes iv = 5 ; // optional, initialization vector for AES-GCM encryption 583} 584 585message Trailer { 586required string stream_id = 1 ; // unique identifier for this data stream 587required string reason = 2 ; // reason why the stream was closed (could contain "error" / "interrupted" / empty for expected end) 588map < string , string > attributes = 3 ; // finalizing updates for the stream, can also include additional insights for errors or endTime for transcription 589} 590} 591 592message DataStreamHeaderReceived { 593required string participant_identity = 1 ; 594required DataStream . Header header = 2 ; 595} 596 597message DataStreamChunkReceived { 598required string participant_identity = 1 ; 599required DataStream . Chunk chunk = 2 ; 600} 601 602message DataStreamTrailerReceived { 603required string participant_identity = 1 ; 604required DataStream . Trailer trailer = 2 ; 605} 606 607message SendStreamHeaderRequest { 608required uint64 local_participant_handle = 1 ; 609required DataStream . Header header = 2 ; 610repeated string destination_identities = 3 ; 611required string sender_identity = 4 ; 612} 613 614message SendStreamChunkRequest { 615required uint64 local_participant_handle = 1 ; 616required DataStream . Chunk chunk = 2 ; 617repeated string destination_identities = 3 ; 618required string sender_identity = 4 ; 619} 620 621message SendStreamTrailerRequest { 622required uint64 local_participant_handle = 1 ; 623required DataStream . Trailer trailer = 2 ; 624repeated string destination_identities = 3 ; 625required string sender_identity = 4 ; 626} 627 628message SendStreamHeaderResponse { 629required uint64 async_id = 1 ; 630} 631 632message SendStreamChunkResponse { 633required uint64 async_id = 1 ; 634} 635 636message SendStreamTrailerResponse { 637required uint64 async_id = 1 ; 638} 639 640message SendStreamHeaderCallback { 641required uint64 async_id = 1 ; 642optional string error = 2 ; 643} 644 645message SendStreamChunkCallback { 646required uint64 async_id = 1 ; 647optional string error = 2 ; 648} 649 650message SendStreamTrailerCallback { 651required uint64 async_id = 1 ; 652optional string error = 2 ; 653} 654 655message SetDataChannelBufferedAmountLowThresholdRequest { 656required uint64 local_participant_handle = 1 ; 657required uint64 threshold = 2 ; 658required DataPacketKind kind = 3 ; 659} 660 661message SetDataChannelBufferedAmountLowThresholdResponse { 662} 663 664message DataChannelBufferedAmountLowThresholdChanged { 665required DataPacketKind kind = 1 ; 666required uint64 threshold = 2 ; 667}