pub struct UseCameraStream {
pub status: Signal<StreamStatus>,
pub active: Signal<bool>,
pub capture_frame: Callback<(), Option<Frame>>,
}Expand description
Handle returned by use_camera_stream.
All fields are public signals / callbacks, data-oriented, no methods,
no hidden state. Read status, write active, call capture_frame
directly.
Fields§
§status: Signal<StreamStatus>Lifecycle of the stream. See StreamStatus.
active: Signal<bool>Whether the pump actively streams frames to the preview.
Default true. Setting to false parks the pump, no more
cameras::next_frame calls, no per-frame Rust work, but keeps the
camera handle open so capture_frame remains fast. Toggle based on
whether the preview is currently visible to the user.
capture_frame: Callback<(), Option<Frame>>Grab a single fresh frame on demand.
Works regardless of active. Returns None if the stream is not
connected or the camera errored.
§UI-thread blocking
This callback blocks the calling thread until the pump worker
replies, typically one frame interval (~16-33ms at 30-60fps), plus
up to 20ms of wake latency if the pump is paused. When called from an
onclick (which runs on the UI thread), expect a brief UI stall.
For single photo-button captures this is imperceptible. For rapid
back-to-back captures, dispatch the call from a
spawn_blocking’d worker or Dioxus
spawn task so the UI thread stays
responsive.
Trait Implementations§
Source§impl Clone for UseCameraStream
impl Clone for UseCameraStream
Source§fn clone(&self) -> UseCameraStream
fn clone(&self) -> UseCameraStream
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more