Update README.md (#15)

* Update README.md

* videoframes example

* fix indents

* fix indents x2
This commit is contained in:
Théo Monnom
2023-01-02 22:16:03 +01:00
committed by GitHub
parent 11d5359464
commit e7d72165b4
+22 -1
View File
@@ -1,5 +1,6 @@
# LiveKit: Native SDK # LiveKit: Native SDK
![crates.io](https://img.shields.io/crates/v/livekit.svg)
[![Tests & Build](https://github.com/livekit/client-sdk-native/actions/workflows/rust.yml/badge.svg?branch=main)](https://github.com/livekit/client-sdk-native/actions/workflows/rust.yml)
> **Warning** > **Warning**
> This SDK is a developer preview and is not ready for production use. There will be bugs and the APIs may change during this period. > This SDK is a developer preview and is not ready for production use. There will be bugs and the APIs may change during this period.
> All feedbacks/contributions are appreciated. You can create issues or discuss with us on the #rust-developer-preview channel in our [Slack](https://livekit.io/join-slack) > All feedbacks/contributions are appreciated. You can create issues or discuss with us on the #rust-developer-preview channel in our [Slack](https://livekit.io/join-slack)
@@ -64,6 +65,26 @@ async fn main() -> Result<()> {
} }
``` ```
### Receive video frames of a subscribed track
```rust
match event {
RoomEvent::TrackSubscribed { track, publication, participant } => {
if let RemoteTrackHandle::Video(video_track) => {
let rtc_track = video_track.rtc_track();
rtc_track.on_frame(Box::new(move |frame, buffer| {
// Just received a video frame!
// The buffer is YuvEncoded, you can decode it to ABGR by using our yuv_helper
// See the simple_room example for the conversion
});
} else {
// Audio Track..
}
}
_ => {}
}
```
## Examples ## Examples
We made [simple room](https://github.com/livekit/client-sdk-native/tree/main/examples/simple_room) demo using all features of the SDK. We render videos using wgpu and egui. We made [simple room](https://github.com/livekit/client-sdk-native/tree/main/examples/simple_room) demo using all features of the SDK. We render videos using wgpu and egui.