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
impl CameraSession
Sourcepub fn start(
app: &App,
camera: &dyn CameraDevice,
format: &CameraFormat,
outputs: CameraOutputs,
) -> Task<Result<Ref<CameraSession>, CameraError>> ⓘ
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.
Sourcepub fn format(self: Handle<Self>, app: &App) -> &CameraFormat
pub fn format(self: Handle<Self>, app: &App) -> &CameraFormat
The format the camera runs in: the one picked, unless the session joined another.
Sourcepub fn state(self: Handle<Self>, app: &App) -> &CaptureState
pub fn state(self: Handle<Self>, app: &App) -> &CaptureState
The session’s state when it last changed.
Sourcepub fn video_rotation_angle_for_horizon_level_preview(
self: Handle<Self>,
app: &App,
) -> u32
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.
Sourcepub fn video_rotation_angle_for_horizon_level_capture(
self: Handle<Self>,
app: &App,
) -> u32
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.
Sourcepub fn preview_layer(
self: Handle<Self>,
app: &App,
) -> Option<&Arc<dyn CompositionLayer>>
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.
Sourcepub fn take_photo(self: Handle<Self>, app: &App) -> PhotoFuture
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.
Sourcepub fn start_recording(
self: Handle<Self>,
app: &App,
path: PathBuf,
) -> RecordingFuture
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.
Sourcepub fn stop_recording(self: Handle<Self>, app: &App)
pub fn stop_recording(self: Handle<Self>, app: &App)
Ends the recording, whose future then answers.
Trait Implementations§
Source§impl ChangeNotifier for CameraSession
impl ChangeNotifier for CameraSession
fn change_notifier_data(&self) -> &ChangeNotifierData
fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData
Source§fn will_add_listener(self: Handle<Self>, app: &mut App)
fn will_add_listener(self: Handle<Self>, app: &mut App)
addListener that
work before super.addListener go here.Source§fn did_remove_listener(self: Handle<Self>, app: &mut App)
fn did_remove_listener(self: Handle<Self>, app: &mut App)
removeListener that
work after super.removeListener go here.