19#include "media_lib_os.h"
20#include "esp_capture.h"
23#include "livekit_types.h"
24#include "livekit_rpc.h"
33 LIVEKIT_ERR_INVALID_ARG = -1,
34 LIVEKIT_ERR_NO_MEM = -2,
35 LIVEKIT_ERR_ENGINE = -3,
36 LIVEKIT_ERR_OTHER = -4,
37 LIVEKIT_ERR_INVALID_STATE = -5,
38 LIVEKIT_ERR_SYSTEM_INIT = -6
43 LIVEKIT_VIDEO_CODEC_NONE = 0,
44 LIVEKIT_VIDEO_CODEC_H264 = 1
45} livekit_video_codec_t;
49 LIVEKIT_AUDIO_CODEC_NONE = 0,
50 LIVEKIT_AUDIO_CODEC_G711A = 1,
51 LIVEKIT_AUDIO_CODEC_G711U = 2,
52 LIVEKIT_AUDIO_CODEC_OPUS = 3
53} livekit_audio_codec_t;
57 LIVEKIT_MEDIA_TYPE_NONE = 0,
58 LIVEKIT_MEDIA_TYPE_AUDIO = (1 << 0),
59 LIVEKIT_MEDIA_TYPE_VIDEO = (1 << 1),
60 LIVEKIT_MEDIA_TYPE_BOTH = LIVEKIT_MEDIA_TYPE_AUDIO | LIVEKIT_MEDIA_TYPE_VIDEO,
61} livekit_media_kind_t;
livekit_err_t livekit_room_close(livekit_room_handle_t handle)
Disconnects from a room asynchronously.
livekit_connection_state_t
Connection state of a room.
Definition livekit_types.h:25
const char * livekit_failure_reason_str(livekit_failure_reason_t reason)
Gets a string representation for a failure reason.
livekit_failure_reason_t
Reason why room connection failed.
Definition livekit_types.h:35
livekit_failure_reason_t livekit_room_get_failure_reason(livekit_room_handle_t handle)
Gets the reason why the room connection failed.
livekit_connection_state_t livekit_room_get_state(livekit_room_handle_t handle)
Gets the current connection state of a room.
const char * livekit_connection_state_str(livekit_connection_state_t state)
Gets a string representation of a connection state.
livekit_err_t livekit_room_connect(livekit_room_handle_t handle, const char *server_url, const char *token)
Connects to a room asynchronously.
livekit_data_payload_t * payload
Data to publish and its size.
Definition livekit.h:383
livekit_data_payload_t payload
Received data.
Definition livekit.h:118
size_t size
Size of the data.
Definition livekit.h:110
char * topic
Topic the data was sent under if specified by the sender.
Definition livekit.h:121
uint8_t * bytes
Pointer to data.
Definition livekit.h:109
char ** destination_identities
Identifies of participants to send the data packet to.
Definition livekit.h:393
int destination_identities_count
Number of destination identities.
Definition livekit.h:396
char * topic
Topic to send the data packet under.
Definition livekit.h:386
bool lossy
Whether the data packet is sent using the lossy channel.
Definition livekit.h:389
char * sender_identity
Identity of the participant who sent the data.
Definition livekit.h:124
livekit_err_t livekit_room_publish_data(livekit_room_handle_t handle, livekit_data_publish_options_t *options)
Publishes a data packet to participants in a room asynchronously.
Payload containing a pointer to data and its size.
Definition livekit.h:108
Options passed to livekit_room_publish_data.
Definition livekit.h:381
Information about a data packet received from a remote participant passed to livekit_room_options_t::...
Definition livekit.h:116
const char * sid
Unique identifier generated by LiveKit server.
Definition livekit.h:176
const char * name
Optional display name.
Definition livekit.h:133
uint32_t participant_count
Number of participants in the room, including the local participant.
Definition livekit.h:137
livekit_participant_kind_t kind
The participant's kind (e.g. standard, agent, etc.).
Definition livekit.h:184
livekit_participant_state_t state
The current state of the participant.
Definition livekit.h:186
const char * identity
Unique identity of the participant, as specified when connecting.
Definition livekit.h:178
const char * metadata
Optional arbitrary metadata in string format.
Definition livekit.h:135
bool active_recording
Whether the room is actively being recorded.
Definition livekit.h:139
const char * sid
Unique identifier generated by LiveKit server.
Definition livekit.h:131
const char * name
Optional display name.
Definition livekit.h:180
const char * metadata
Optional arbitrary metadata in string format.
Definition livekit.h:182
livekit_participant_kind_t
Participant kind.
Definition livekit.h:144
livekit_participant_state_t
Participant state.
Definition livekit.h:161
@ LIVEKIT_PARTICIPANT_KIND_SIP
A telephony user connected via SIP.
Definition livekit.h:154
@ LIVEKIT_PARTICIPANT_KIND_AGENT
An agent spawned with the Agents Framework.
Definition livekit.h:156
@ LIVEKIT_PARTICIPANT_KIND_INGRESS
A server-side process that is ingesting media into the session using LiveKit Ingress.
Definition livekit.h:149
@ LIVEKIT_PARTICIPANT_KIND_EGRESS
A server-side process that is recording the session using LiveKit Egress.
Definition livekit.h:152
@ LIVEKIT_PARTICIPANT_KIND_STANDARD
A regular participant, typically an end-user in your application.
Definition livekit.h:146
@ LIVEKIT_PARTICIPANT_STATE_ACTIVE
The participant is connected to the room and can publish or subscribe to media.
Definition livekit.h:167
@ LIVEKIT_PARTICIPANT_STATE_JOINING
The participant is in the process of joining the room.
Definition livekit.h:163
@ LIVEKIT_PARTICIPANT_STATE_DISCONNECTED
The participant has disconnected from the room.
Definition livekit.h:169
@ LIVEKIT_PARTICIPANT_STATE_JOINED
The participant has joined the room but is not able to publish or subscribe to media yet.
Definition livekit.h:165
Information about a participant in a room.
Definition livekit.h:174
Information about a room.
Definition livekit.h:129
void * ctx
User context passed to all handlers.
Definition livekit.h:226
livekit_pub_options_t publish
Options for publishing media.
Definition livekit.h:199
void(* on_state_changed)(livekit_connection_state_t state, void *ctx)
Handler for when the room's connection state changes.
Definition livekit.h:207
void(* on_data_received)(const livekit_data_received_t *data, void *ctx)
Handler for data packets received from remote participants.
Definition livekit.h:215
void(* on_rpc_result)(const livekit_rpc_result_t *result, void *ctx)
Handler for when an RPC method invoked with livekit_room_rpc_invoke returns a result.
Definition livekit.h:211
void(* on_participant_info)(const livekit_participant_info_t *info, void *ctx)
Handler for when participant information is received.
Definition livekit.h:223
livekit_sub_options_t subscribe
Options for subscribing to media.
Definition livekit.h:203
void(* on_room_info)(const livekit_room_info_t *info, void *ctx)
Handler for when room information is received.
Definition livekit.h:219
livekit_err_t livekit_room_create(livekit_room_handle_t *handle, const livekit_room_options_t *options)
Creates a room.
void * livekit_room_handle_t
Handle to a room object.
Definition livekit.h:249
livekit_err_t livekit_room_destroy(livekit_room_handle_t handle)
Destroys a room.
Options for creating a room.
Definition livekit.h:196
void(* livekit_rpc_handler_t)(const livekit_rpc_invocation_t *invocation, void *ctx)
Handler for an RPC invocation.
Definition livekit_rpc.h:111
livekit_err_t livekit_room_rpc_register(livekit_room_handle_t handle, const char *method, livekit_rpc_handler_t handler)
Registers a handler for an RPC method.
livekit_err_t livekit_room_rpc_unregister(livekit_room_handle_t handle, const char *method)
Unregisters a handler for an RPC method.
livekit_err_t livekit_system_init(void)
Performs one-time system initialization.
livekit_video_encode_options_t video_encode
Video encoder options.
Definition livekit.h:85
esp_capture_handle_t capturer
Capturer to use for obtaining media to publish.
Definition livekit.h:93
livekit_video_codec_t codec
Codec to use for encoding.
Definition livekit.h:65
livekit_media_kind_t kind
Kind of media that can be published.
Definition livekit.h:81
livekit_audio_codec_t codec
Codec to use for encoding.
Definition livekit.h:73
int fps
Output frame per second.
Definition livekit.h:68
livekit_audio_encode_options_t audio_encode
Audio encoder options.
Definition livekit.h:89
uint32_t sample_rate
Output sample rate in Hz.
Definition livekit.h:74
int height
Output frame height in pixels.
Definition livekit.h:67
int width
Output frame width in pixels.
Definition livekit.h:66
uint8_t channel_count
Output number of channels.
Definition livekit.h:75
livekit_media_kind_t kind
Kind of media that can be subscribed to.
Definition livekit.h:99
av_render_handle_t renderer
Renderer to use for subscribed media tracks.
Definition livekit.h:103
Options for the audio encoder.
Definition livekit.h:72
Options for publishing media.
Definition livekit.h:79
The result of an RPC method invocation.
Definition livekit_rpc.h:69
Options for subscribing to media.
Definition livekit.h:97
Options for the video encoder.
Definition livekit.h:64