Skip to main content

CaptureSession

Trait CaptureSession 

Source
pub trait CaptureSession {
    // Required methods
    fn format(&self) -> CameraFormat;
    fn state(&self) -> CaptureState;
    fn changed(&self) -> MediaChangeFuture;
    fn take_photo(&self) -> PhotoFuture;
    fn start_recording(&self, path: PathBuf) -> RecordingFuture;
    fn stop_recording(&self);
}
Expand description

A camera running for the app, controlled on the app’s main thread. Dropped, it stops for the app: its preview leaves the layer it showed on, and its reader reads nothing more.

Required Methods§

Source

fn format(&self) -> CameraFormat

The format it runs in: the one picked, unless it joined the format the camera ran in for another session.

Source

fn state(&self) -> CaptureState

The session’s state now.

Source

fn changed(&self) -> MediaChangeFuture

Resolves once state may answer something else than when this was called, or once the session is gone.

Source

fn take_photo(&self) -> PhotoFuture

Takes a photo while the session runs with photos among its outputs, answering it once the system has encoded it.

Source

fn start_recording(&self, path: PathBuf) -> RecordingFuture

Records to a new file at path, as a QuickTime movie, while the session runs with movies among its outputs, until stop_recording; answers once the file is written whole, or why it was not.

Source

fn stop_recording(&self)

Ends the recording, whose future then answers.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§