Skip to main content

CameraSession

Struct CameraSession 

Source
pub struct CameraSession { /* private fields */ }
Expand description

A camera running for the app in one format, feeding the outputs it started with, each the system’s own: the host’s session, whose listeners hear its state change.

Implementations§

Source§

impl CameraSession

Source

pub fn start( app: &App, camera: &dyn CameraDevice, format: &CameraFormat, outputs: CameraOutputs, ) -> Task<Result<Ref<CameraSession>, CameraError>> ⓘ

Starts camera in format, one of its formats, feeding outputs, which the system configures together, and answers the session once it runs, or is interrupted, from which it resumes by itself; where the camera already runs for another session in a format of its own, the session joins that one, which format says. It fails for what can happen at any time: the camera in use, unplugged, or not allowed; and for a format the camera does not list.

Source

pub fn format(self: Handle<Self>, app: &App) -> &CameraFormat

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

Source

pub fn state(self: Handle<Self>, app: &App) -> &CaptureState

The session’s state when it last changed.

Source

pub fn video_rotation_angle_for_horizon_level_preview( self: Handle<Self>, app: &App, ) -> u32

The turn, in degrees clockwise, that keeps the preview level, when it last changed: CaptureSession::video_rotation_angle_for_horizon_level_preview. The system’s preview is turned so on its layer, which a CameraPreview lays out turned.

Source

pub fn video_rotation_angle_for_horizon_level_capture( self: Handle<Self>, app: &App, ) -> u32

The turn that keeps what is captured level, when it last changed: CaptureSession::video_rotation_angle_for_horizon_level_capture.

Source

pub fn preview_layer( self: Handle<Self>, app: &App, ) -> Option<&Arc<dyn CompositionLayer>>

The layer the preview shows on, which a CameraPreview places; None where the session started without one, or once disposed.

Source

pub fn take_photo(self: Handle<Self>, app: &App) -> PhotoFuture

Takes a photo, captured, processed and encoded by the system, while the session runs with photos among its outputs.

Source

pub fn start_recording( self: Handle<Self>, app: &App, path: PathBuf, ) -> RecordingFuture

Records to a new file at path, encoded and written by the system, while the session runs with movies among its outputs, until stop_recording.

Source

pub fn stop_recording(self: Handle<Self>, app: &App)

Ends the recording, whose future then answers.

Source

pub fn dispose(self: Handle<Self>, app: &mut App)

Stops the camera for the app and lets go of the host’s session: its preview leaves the layer it was on, and its listeners hear nothing more.

Trait Implementations§

Source§

impl ChangeNotifier for CameraSession

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

fn will_add_listener(self: Handle<Self>, app: &mut App)

Runs before the listener is stored. Dart overrides of addListener that work before super.addListener go here.
Source§

fn did_remove_listener(self: Handle<Self>, app: &mut App)

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl Debug for CameraSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>