1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//! LiveKit WebRTC bridge for `adk-realtime`.
//!
//! This module provides a provider-agnostic bridge between LiveKit rooms and
//! realtime AI sessions. It re-exports the subset of [`livekit`] and
//! [`livekit_api`] types that are needed to build a voice agent, so downstream
//! crates only need `adk-realtime` in their `Cargo.toml`.
//!
//! # Provided utilities
//!
//! | Type | Purpose |
//! |------|---------|
//! | [`LiveKitEventHandler`] | Wraps any [`EventHandler`](crate::runner::EventHandler) to push model audio to a [`NativeAudioSource`]. |
//! | [`bridge_input`] | Reads audio from a [`RemoteAudioTrack`] and feeds 24 kHz PCM16 to a [`RealtimeRunner`](crate::RealtimeRunner). |
//! | [`bridge_gemini_input`] | Same as [`bridge_input`] but resamples to 16 kHz mono for Gemini Live. |
//!
//! # Feature flag
//!
//! This module requires the **`livekit`** Cargo feature:
//!
//! ```toml
//! [dependencies]
//! adk-realtime = { version = "0.3", features = ["livekit"] }
//! ```
//!
//! # Example
//!
//! ```rust,ignore
//! use adk_realtime::livekit::{
//! AccessToken, AudioSourceOptions, LiveKitEventHandler, NativeAudioSource,
//! Room, RoomOptions, RtcAudioSource, TrackPublishOptions, VideoGrants,
//! bridge_gemini_input,
//! };
//!
//! // 1. Generate a token
//! let token = AccessToken::with_api_key(&key, &secret)
//! .with_identity("agent")
//! .with_grants(VideoGrants {
//! room_join: true,
//! room: "my-room".into(),
//! ..Default::default()
//! })
//! .to_jwt()?;
//!
//! // 2. Connect to the room
//! let (room, mut events) = Room::connect(&url, &token, RoomOptions::default()).await?;
//!
//! // 3. Publish an audio track
//! let audio_source = NativeAudioSource::new(AudioSourceOptions::default(), 24000, 1);
//! let handler = LiveKitEventHandler::new(inner_handler, audio_source.clone());
//! ```
// ── Our bridge utilities ────────────────────────────────────────────────
pub use ;
pub use LiveKitRoomBuilder;
pub use LiveKitConfig;
pub use LiveKitError;
pub use LiveKitEventHandler;
// ── Room and connection ─────────────────────────────────────────────────
//
// Core types for connecting to and interacting with a LiveKit room.
pub use ;
// ── Participants ────────────────────────────────────────────────────────
pub use ;
// ── Tracks ──────────────────────────────────────────────────────────────
//
// Track types used when subscribing to remote audio or publishing local
// audio back into the room.
pub use ;
/// Options for publishing a local track (codec preferences, simulcast, etc.).
pub use TrackPublishOptions;
// ── Audio I/O ───────────────────────────────────────────────────────────
//
// Low-level audio primitives for pushing PCM frames into a room or
// reading them from a subscribed track.
/// A single audio frame (PCM samples + sample rate + channel count).
pub use AudioFrame;
/// Builder options, source wrapper, and platform-native source for
/// pushing audio frames into a LiveKit audio track.
pub use ;
// ── Authentication ──────────────────────────────────────────────────────
//
// Token generation for room access. These come from the `livekit-api`
// crate so downstream consumers do not need a direct dependency on it.
/// JWT access token for authenticating participants.
pub use AccessToken;
/// Permission grants embedded in an [`AccessToken`].
pub use VideoGrants;
/// Convenience prelude that re-exports everything above plus our bridge
/// utilities.
///
/// ```rust,ignore
/// use adk_realtime::livekit::prelude::*;
/// ```