Skip to content

Commit c5f4726

Browse files
committed
received audio frame.
1 parent 365de80 commit c5f4726

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

examples/wgpu_room/src/app.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,15 @@ impl LkApp {
8888
);
8989
self.video_renderers
9090
.insert((participant.identity(), track.sid()), video_renderer);
91-
} else if let RemoteTrack::Audio(_) = track {
92-
// TODO(theomonnom): Once we support media devices, we can play audio tracks here
91+
} else if let RemoteTrack::Audio(ref audio_track) = track {
92+
let rtc_track = audio_track.rtc_track();
93+
let mut audio_stream = NativeAudioStream::new(rtc_track);
94+
tokio::spawn(async move {
95+
// Receive the audio frames in a new task
96+
while let Some(audio_frame) = audio_stream.next().await {
97+
log::info!("received audio frame - {audio_frame:#?}");
98+
}
99+
});
93100
}
94101
}
95102
RoomEvent::TrackUnsubscribed {

0 commit comments

Comments
 (0)