You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+142-7Lines changed: 142 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,20 @@ Use this SDK to add realtime video, audio and data features to your ESP32 projec
20
20
21
21
-**Supported chipsets**: ESP32-S3 and ESP32-P4
22
22
-**Bidirectional audio**: Opus encoding, acoustic echo cancellation (AEC)
23
-
-**Bidirectional video**: *coming soon*
23
+
-**Bidirectional video**: *video support coming soon*
24
24
-**Real-time data**: data packets, remote method calls (RPC)
25
25
26
-
## Installation
26
+
## Examples
27
+
28
+
One of the best ways to get started with LiveKit is by reviewing the examples and choosing one as a starting point for your project:
29
+
30
+
### [Voice AI Agent](./examples/voice_agent/README.md)
31
+
32
+
Conversational AI voice agent that interacts with hardware based on user requests.
33
+
34
+
## Basic usage
35
+
36
+
### Installation
27
37
28
38
In your application's IDF component manifest, add LiveKit as a Git dependency:
29
39
@@ -35,14 +45,139 @@ dependencies:
35
45
version: <current version tag>
36
46
```
37
47
38
-
Please be sure to pin to a specific version tag as subsequent 0.x.x releases may have breaking changes. In the future, this SDK will be added to the [ESP component registry](https://components.espressif.com).
48
+
Please be sure to pin to a specific version tag, as subsequent 0.x.x releases may have breaking changes. In the future, this SDK will be added to the [ESP component registry](https://components.espressif.com).
39
49
40
-
## Examples
50
+
With LiveKit added as a dependency to your application, include the LiveKit header and invoke
51
+
`livekit_system_init` early in your application's main function:
41
52
42
-
One of the best ways to get started with LiveKit is by reviewing the examples and choosing one as a starting point for your project:
53
+
```c
54
+
#include "livekit.h"
55
+
56
+
void app_main(void)
57
+
{
58
+
livekit_system_init();
59
+
// Your application code...
60
+
}
61
+
```
62
+
63
+
### Configure media pipeline
64
+
65
+
LiveKit for ESP32 puts your application in control of the media pipeline; your application configures a capturer and/or renderer and provides their handles when creating a room.
66
+
67
+
#### Capturer: input from camera/microphone
68
+
69
+
- Required for rooms which will publish media tracks
70
+
- Created using the Espressif [*esp_capture*](./components/third_party/esp-webrtc-solution/components/esp_capture/README.md) component
71
+
- Capture audio capture over I2S, video from MIPI CSI or DVI cameras
72
+
- After configuration, you will provide the `esp_capture_handle_t` when creating a room
73
+
74
+
#### Renderer: output to display/speaker
75
+
76
+
- Required for rooms which will subscribe to media tracks
77
+
- Created using the Espressif [*av_render*](./components/third_party/esp-webrtc-solution/components/av_render/README.md) component
78
+
- Playback audio over I2S, video on LCD displays supported by *esp_lcd*
79
+
- After configuration, you will provide the `av_render_handle_t` when creating a room
80
+
81
+
Please refer to the [examples](#examples) in this repository, which support many popular development boards via the Espressif [*codec_board*](./components/third_party/esp-webrtc-solution/components/codec_board/README.md) component.
82
+
83
+
### Create room
84
+
85
+
Create a room object, specifying your capturer, renderer, and handlers for room events:
86
+
87
+
```c
88
+
static livekit_room_handle_t room_handle = NULL;
89
+
90
+
livekit_room_options_t room_options = {
91
+
.publish = {
92
+
.kind = LIVEKIT_MEDIA_TYPE_AUDIO,
93
+
.audio_encode = {
94
+
.codec = LIVEKIT_AUDIO_CODEC_OPUS,
95
+
.sample_rate = 16000,
96
+
.channel_count = 1
97
+
},
98
+
.capturer = my_capturer
99
+
},
100
+
.subscribe = {
101
+
.kind = LIVEKIT_MEDIA_TYPE_AUDIO,
102
+
.renderer = my_renderer
103
+
},
104
+
.on_state_changed = on_state_changed,
105
+
.on_participant_info = on_participant_info
106
+
};
107
+
if (livekit_room_create(&room_handle, &room_options) != LIVEKIT_ERR_NONE) {
108
+
ESP_LOGE(TAG, "Failed to create room object");
109
+
}
110
+
```
111
+
112
+
This example does not show all available fields in room options—please refer to the [API reference](https://livekit.github.io/client-sdk-esp32/group__Lifecycle.html#structlivekit__room__options__t)
113
+
for an extensive list.
114
+
115
+
Typically, you will want to create the room object early in your application's lifecycle, and connect/disconnect as necessary based on user interaction.
116
+
117
+
### Connect room
43
118
44
-
- [Voice Agent](./examples/voice_agent/README.md): conversational AI voice agent that interacts with hardware based on user requests.
45
-
- *More examples coming soon*
119
+
With a room room handle, connect by providing a server URL and token:
120
+
121
+
```c
122
+
livekit_room_connect(room_handle, "<your server URL>", "<token>");
123
+
```
124
+
125
+
The connect method is asynchronous; use your `on_state_changed` handler provided in room options
126
+
to get notified when the connection is established or fails (e.g. due to an expired token, etc.).
127
+
128
+
Once connected, media exchange will begin:
129
+
130
+
1. If a capturer was provided, video and/or audio tracks will be published.
131
+
2. If a renderer was provided, the first video and/or audio tracks in the room will be subscribed to.
132
+
133
+
### Real-time data
134
+
135
+
In addition to real-time audio and video, LiveKit offers several methods for exchange real-time data between participants in a room.
0 commit comments