diff --git a/crates/live_kit_client/src/live_kit_client.rs b/crates/live_kit_client/src/live_kit_client.rs index bb77eafdf7bd80..a816a9ee94e47d 100644 --- a/crates/live_kit_client/src/live_kit_client.rs +++ b/crates/live_kit_client/src/live_kit_client.rs @@ -218,8 +218,16 @@ pub fn capture_local_audio_track( ); } if let Some(stream) = &stream { - loop { - stream.play().log_err(); + stream.play().log_err(); + } + + // We need to keep the thread alive and task not dropped, so the `stream` is not dropped. + // `stream` is `!Send` so we cannot move it away anywhere else. + loop { + std::thread::park(); + // Suppress the unreachable code warning + if false { + break; } }