Skip to content
Draft
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
508 changes: 455 additions & 53 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ members = [
"examples/basic_text_stream",
"examples/encrypted_text_stream",
"examples/local_audio",
"examples/local_video",
"examples/mobile",
"examples/play_from_disk",
"examples/rpc",
Expand Down
39 changes: 39 additions & 0 deletions examples/local_video/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "local_video"
version = "0.1.0"
edition = "2021"
publish = false

[[bin]]
name = "publisher"
path = "src/publisher.rs"

[[bin]]
name = "subscriber"
path = "src/subscriber.rs"

[dependencies]
tokio = { version = "1", features = ["full", "parking_lot"] }
livekit = { workspace = true, features = ["rustls-tls-native-roots"] }
webrtc-sys = { workspace = true }
libwebrtc = { workspace = true }
livekit-api = { workspace = true }
yuv-sys = { workspace = true }
futures = "0.3"
clap = { version = "4.5", features = ["derive"] }
log = "0.4"
env_logger = "0.10.0"
nokhwa = { version = "0.10", default-features = false, features = ["input-avfoundation", "input-v4l", "input-msmf", "output-threaded"] }
image = "0.24"
egui = "0.31.1"
egui-wgpu = "0.31.1"
eframe = { version = "0.31.1", default-features = false, features = ["default_fonts", "wgpu", "persistence"] }
wgpu = "25.0"
winit = { version = "0.30.11", features = ["android-native-activity"] }
parking_lot = { version = "0.12.1", features = ["deadlock_detection"] }
anyhow = "1"

[target.'cfg(target_os = "macos")'.dependencies]
objc2 = { version = "0.6.0", features = ["relax-sign-encoding"] }


40 changes: 40 additions & 0 deletions examples/local_video/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# local_video

Two examples demonstrating capturing frames from a local camera video and publishing to LiveKit, and subscribing to render video in a window.

- publisher: capture from a selected camera and publish a video track
- subscriber: connect to a room, subscribe to video tracks, and display in a window

LiveKit connection can be provided via flags or environment variables:
- `--url` or `LIVEKIT_URL`
- `--api-key` or `LIVEKIT_API_KEY`
- `--api-secret` or `LIVEKIT_API_SECRET`

Publisher usage:
```
cargo run -p local_video --bin publisher -- --list-cameras
cargo run -p local_video --bin publisher -- --camera-index 0 --room-name demo --identity cam-1

# with explicit LiveKit connection flags
cargo run -p local_video --bin publisher -- \
--camera-index 0 \
--room-name demo \
--identity cam-1 \
--url https://your.livekit.server \
--api-key YOUR_KEY \
--api-secret YOUR_SECRET
```

Subscriber usage:
```
# relies on env vars LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET
cargo run -p local_video --bin subscriber -- --room-name demo --identity viewer-1

# or pass credentials via flags
cargo run -p local_video --bin subscriber -- \
--room-name demo \
--identity viewer-1 \
--url https://your.livekit.server \
--api-key YOUR_KEY \
--api-secret YOUR_SECRET
```
Loading