pub struct JSCameraConstraintsBuilder { /* private fields */ }
Available on crate feature input-jscam only.
Expand description

A builder that builds a JSCameraConstraints that is used to construct a JSCamera. See More: Constraints MDN, Properties of Media Tracks MDN

JS-WASM

This is exported as CameraConstraintsBuilder.

Implementations§

source§

impl JSCameraConstraintsBuilder

source

pub fn new() -> Self

Constructs a default JSCameraConstraintsBuilder. The constructed default JSCameraConstraintsBuilder has these settings:

  • 480x234 min, 640x360 ideal, 1920x1080 max
  • 10 FPS min, 15 FPS ideal, 30 FPS max
  • 1.0 aspect ratio min, 1.77777777778 aspect ratio ideal, 2.0 aspect ratio max
  • No exacts
JS-WASM

This is exported as a constructor.

source

pub fn min_resolution( self, min_resolution: Resolution ) -> JSCameraConstraintsBuilder

Sets the minimum resolution for the JSCameraConstraintsBuilder.

Sets width and height.

JS-WASM

This is exported as set_MinResolution.

source

pub fn resolution( self, new_resolution: Resolution ) -> JSCameraConstraintsBuilder

Sets the preferred resolution for the JSCameraConstraintsBuilder.

Sets width and height.

JS-WASM

This is exported as set_Resolution.

source

pub fn max_resolution( self, max_resolution: Resolution ) -> JSCameraConstraintsBuilder

Sets the maximum resolution for the JSCameraConstraintsBuilder.

Sets width and height.

JS-WASM

This is exported as set_MaxResolution.

source

pub fn resolution_exact(self, value: bool) -> JSCameraConstraintsBuilder

Sets whether the resolution fields (width, height/resolution) should use exact. Note that this will make the builder ignore min_resolution and max_resolution.

JS-WASM

This is exported as set_ResolutionExact.

source

pub fn min_aspect_ratio(self, ratio: f64) -> JSCameraConstraintsBuilder

Sets the minimum aspect ratio of the resulting constraint for the JSCameraConstraintsBuilder.

Sets aspectRatio.

JS-WASM

This is exported as set_MinAspectRatio.

source

pub fn aspect_ratio(self, ratio: f64) -> JSCameraConstraintsBuilder

Sets the aspect ratio of the resulting constraint for the JSCameraConstraintsBuilder.

Sets aspectRatio.

JS-WASM

This is exported as set_AspectRatio.

source

pub fn max_aspect_ratio(self, ratio: f64) -> JSCameraConstraintsBuilder

Sets the maximum aspect ratio of the resulting constraint for the JSCameraConstraintsBuilder.

Sets aspectRatio.

JS-WASM

This is exported as set_MaxAspectRatio.

source

pub fn aspect_ratio_exact(self, value: bool) -> JSCameraConstraintsBuilder

Sets whether the aspect_ratio field should use exact. Note that this will make the builder ignore min_aspect_ratio and max_aspect_ratio.

JS-WASM

This is exported as set_AspectRatioExact.

source

pub fn facing_mode( self, facing_mode: JSCameraFacingMode ) -> JSCameraConstraintsBuilder

Sets the facing mode of the resulting constraint for the JSCameraConstraintsBuilder.

Sets facingMode.

JS-WASM

This is exported as set_FacingMode.

source

pub fn facing_mode_exact(self, value: bool) -> JSCameraConstraintsBuilder

Sets whether the facing_mode field should use exact.

JS-WASM

This is exported as set_FacingModeExact.

source

pub fn min_frame_rate(self, fps: u32) -> JSCameraConstraintsBuilder

Sets the minimum frame rate of the resulting constraint for the JSCameraConstraintsBuilder.

Sets frameRate.

JS-WASM

This is exported as set_MinFrameRate.

source

pub fn frame_rate(self, fps: u32) -> JSCameraConstraintsBuilder

Sets the frame rate of the resulting constraint for the JSCameraConstraintsBuilder.

Sets frameRate.

JS-WASM

This is exported as set_FrameRate.

source

pub fn max_frame_rate(self, fps: u32) -> JSCameraConstraintsBuilder

Sets the maximum frame rate of the resulting constraint for the JSCameraConstraintsBuilder.

Sets frameRate.

JS-WASM

This is exported as set_MaxFrameRate.

source

pub fn frame_rate_exact(self, value: bool) -> JSCameraConstraintsBuilder

Sets whether the frame_rate field should use exact. Note that this will make the builder ignore min_frame_rate and max_frame_rate.

JS-WASM

This is exported as set_FrameRateExact.

source

pub fn resize_mode( self, resize_mode: JSCameraResizeMode ) -> JSCameraConstraintsBuilder

Sets the resize mode of the resulting constraint for the JSCameraConstraintsBuilder.

Sets resizeMode.

JS-WASM

This is exported as set_ResizeMode.

source

pub fn resize_mode_exact(self, value: bool) -> JSCameraConstraintsBuilder

Sets whether the resize_mode field should use exact.

JS-WASM

This is exported as set_ResizeModeExact.

source

pub fn device_id(self, id: &str) -> JSCameraConstraintsBuilder

Sets the device ID of the resulting constraint for the JSCameraConstraintsBuilder.

Sets deviceId.

JS-WASM

This is exported as set_DeviceId.

source

pub fn device_id_exact(self, value: bool) -> JSCameraConstraintsBuilder

Sets whether the device_id field should use exact.

JS-WASM

This is exported as set_DeviceIdExact.

source

pub fn group_id(self, id: &str) -> JSCameraConstraintsBuilder

Sets the group ID of the resulting constraint for the JSCameraConstraintsBuilder.

Sets groupId.

JS-WASM

This is exported as set_GroupId.

source

pub fn group_id_exact(self, value: bool) -> JSCameraConstraintsBuilder

Sets whether the group_id field should use exact.

JS-WASM

This is exported as set_GroupIdExact.

source§

impl JSCameraConstraintsBuilder

Trait Implementations§

source§

impl Clone for JSCameraConstraintsBuilder

source§

fn clone(&self) -> JSCameraConstraintsBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for JSCameraConstraintsBuilder

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for JSCameraConstraintsBuilder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<T> Upcast<T> for T

§

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