Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ soxr-sys/test-input.wav
soxr-sys/test-output.wav
.DS_Store
.env
.cursor
.cursor
examples/mobile/android/.idea/AndroidProjectSystem.xml
45 changes: 14 additions & 31 deletions examples/mobile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,14 @@ pub fn livekit_connect(url: String, token: String) {
}

// Create and publish local audio track
let track = LocalAudioTrack::create_audio_track(
"microphone",
RtcAudioSource::Native(audio_source),
);
let track =
LocalAudioTrack::create_audio_track("microphone", RtcAudioSource::Native(audio_source));

if let Err(e) = room
.local_participant()
.publish_track(
LocalTrack::Audio(track),
TrackPublishOptions {
source: TrackSource::Microphone,
..Default::default()
},
TrackPublishOptions { source: TrackSource::Microphone, ..Default::default() },
)
.await
{
Expand All @@ -141,11 +136,7 @@ pub fn livekit_connect(url: String, token: String) {
// Handle room events
while let Some(event) = events.recv().await {
match event {
RoomEvent::TrackSubscribed {
track,
publication,
participant,
} => {
RoomEvent::TrackSubscribed { track, publication, participant } => {
log::info!(
"Track subscribed from {}: {} ({:?})",
participant.identity(),
Expand All @@ -168,11 +159,7 @@ pub fn livekit_connect(url: String, token: String) {
});
}
}
RoomEvent::TrackUnsubscribed {
track,
participant,
..
} => {
RoomEvent::TrackUnsubscribed { track, participant, .. } => {
log::info!(
"Track unsubscribed from {}: {:?}",
participant.identity(),
Expand Down Expand Up @@ -216,11 +203,8 @@ async fn handle_remote_audio_stream(
audio_track.sid()
);

let mut audio_stream = NativeAudioStream::new(
audio_track.rtc_track(),
SAMPLE_RATE as i32,
NUM_CHANNELS as i32,
);
let mut audio_stream =
NativeAudioStream::new(audio_track.rtc_track(), SAMPLE_RATE as i32, NUM_CHANNELS as i32);

let mut frame_count: u64 = 0;
let mut total_samples: u64 = 0;
Expand Down Expand Up @@ -450,9 +434,7 @@ pub mod android {
#[no_mangle]
pub extern "C" fn JNI_OnLoad(vm: JavaVM, _: *mut c_void) -> jint {
android_logger::init_once(
Config::default()
.with_max_level(LevelFilter::Debug)
.with_tag("livekit-rustexample"),
Config::default().with_max_level(LevelFilter::Debug).with_tag("livekit-rustexample"),
);

log::info!("JNI_OnLoad, initializing LiveKit");
Expand All @@ -478,10 +460,7 @@ pub mod android {
/// Disconnect from the room
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn Java_io_livekit_rustexample_App_disconnectNative(
_env: JNIEnv,
_: JClass,
) {
pub extern "C" fn Java_io_livekit_rustexample_App_disconnectNative(_env: JNIEnv, _: JClass) {
super::disconnect();
}

Expand All @@ -492,7 +471,11 @@ pub mod android {
_env: JNIEnv,
_: JClass,
) -> jboolean {
if super::is_connected() { 1 } else { 0 }
if super::is_connected() {
1
} else {
0
}
}

/// Push captured audio samples to LiveKit
Expand Down
1 change: 1 addition & 0 deletions livekit-api/src/services/ingress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ impl IngressClient {
IngressListFilter::Room(room) => room,
_ => Default::default(),
},
page_token: Default::default(),
},
self.base
.auth_header(VideoGrants { ingress_admin: true, ..Default::default() }, None)?,
Expand Down
4 changes: 2 additions & 2 deletions livekit-ffi/src/conversion/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl From<ParticipantKind> for proto::ParticipantKind {
ParticipantKind::Egress => proto::ParticipantKind::Egress,
ParticipantKind::Agent => proto::ParticipantKind::Agent,
ParticipantKind::Connector => proto::ParticipantKind::Connector,
ParticipantKind::Bridge => proto::ParticipantKind::Bridge
ParticipantKind::Bridge => proto::ParticipantKind::Bridge,
}
}
}
Expand All @@ -72,7 +72,7 @@ impl From<ParticipantKindDetail> for proto::ParticipantKindDetail {
proto::ParticipantKindDetail::ConnectorWhatsapp
}
ParticipantKindDetail::ConnectorTwilio => proto::ParticipantKindDetail::ConnectorTwilio,
ParticipantKindDetail::BridgeRtsp => proto::ParticipantKindDetail::BridgeRtsp
ParticipantKindDetail::BridgeRtsp => proto::ParticipantKindDetail::BridgeRtsp,
}
}
}
Expand Down
33 changes: 29 additions & 4 deletions livekit-protocol/src/livekit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ pub struct ParticipantInfo {
pub kind_details: ::prost::alloc::vec::Vec<i32>,
#[prost(message, repeated, tag="19")]
pub data_tracks: ::prost::alloc::vec::Vec<DataTrackInfo>,
/// protocol version used for client feature compatibility
#[prost(int32, tag="20")]
pub client_protocol: i32,
}
/// Nested message and enum types in `ParticipantInfo`.
pub mod participant_info {
Expand Down Expand Up @@ -1066,6 +1069,9 @@ pub struct ClientInfo {
/// e.g. "components-js:1.2.3,track-processors-js:1.2.3"
#[prost(string, tag="11")]
pub other_sdks: ::prost::alloc::string::String,
/// client protocol version
#[prost(int32, tag="12")]
pub client_protocol: i32,
}
/// Nested message and enum types in `ClientInfo`.
pub mod client_info {
Expand Down Expand Up @@ -4426,6 +4432,25 @@ pub struct JobTermination {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AgentSessionState {
#[prost(uint64, tag="1")]
pub version: u64,
#[prost(oneof="agent_session_state::Data", tags="2, 3")]
pub data: ::core::option::Option<agent_session_state::Data>,
}
/// Nested message and enum types in `AgentSessionState`.
pub mod agent_session_state {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Data {
#[prost(bytes, tag="2")]
Snapshot(::prost::alloc::vec::Vec<u8>),
#[prost(bytes, tag="3")]
Delta(::prost::alloc::vec::Vec<u8>),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextMessageRequest {
#[prost(string, tag="1")]
pub message_id: ::prost::alloc::string::String,
Expand All @@ -4435,8 +4460,8 @@ pub struct TextMessageRequest {
pub agent_name: ::prost::alloc::string::String,
#[prost(string, tag="4")]
pub metadata: ::prost::alloc::string::String,
#[prost(bytes="vec", tag="5")]
pub session_data: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="5")]
pub session_state: ::core::option::Option<AgentSessionState>,
#[prost(string, tag="6")]
pub text: ::prost::alloc::string::String,
}
Expand All @@ -4455,8 +4480,8 @@ pub struct TextMessageResponse {
/// Indicate the request is completed
#[prost(string, tag="1")]
pub message_id: ::prost::alloc::string::String,
#[prost(bytes="vec", tag="2")]
pub session_data: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub session_state: ::core::option::Option<AgentSessionState>,
#[prost(string, tag="3")]
pub error: ::prost::alloc::string::String,
}
Expand Down
Loading
Loading