Lightweight native Discord client for Windows, Linux and macOS, written in Rust. No Electron, no browser engine.
Rust desktop-appdiscorddiscord-clienteguielectron-alternativelightweightlinuxmacosnative-apprustwindows
//! Manual check of webcam capture: lists the cameras and reads a preview picture from
//! the first one. Ignored by default (it turns a real camera on for a moment):
//! `cargo test -p voice --test camera_probe -- --ignored --nocapture`.
#[test]
#[ignore = "opens a real camera"]
fn first_camera_gives_a_preview_picture() {
let cameras = voice::cameras();
println!("cameras: {cameras:?}");
let Some(first) = cameras.first() else {
println!("no camera connected: nothing to open");
return;
};
let camera = voice::Camera::open(&first.id, || {}).expect("camera opens");
let started = std::time::Instant::now();
let frame = loop {
if let Some(frame) = camera.preview() {
break frame;
}
assert!(started.elapsed() < std::time::Duration::from_secs(10), "no picture within 10 s");
std::thread::sleep(std::time::Duration::from_millis(50));
};
println!("preview: {} x {} after {:?}", frame.width, frame.height, started.elapsed());
assert!(frame.width >= 2 && frame.height >= 2);
}