Struct nokhwa::js_camera::JSCameraConstraintsBuilder
source · pub struct JSCameraConstraintsBuilder { /* private fields */ }
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
impl JSCameraConstraintsBuilder
sourcepub fn new() -> Self
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
exact
s
JS-WASM
This is exported as a constructor.
sourcepub fn min_resolution(
self,
min_resolution: Resolution
) -> JSCameraConstraintsBuilder
pub fn min_resolution( self, min_resolution: Resolution ) -> JSCameraConstraintsBuilder
Sets the minimum resolution for the JSCameraConstraintsBuilder
.
JS-WASM
This is exported as set_MinResolution
.
sourcepub fn resolution(
self,
new_resolution: Resolution
) -> JSCameraConstraintsBuilder
pub fn resolution( self, new_resolution: Resolution ) -> JSCameraConstraintsBuilder
Sets the preferred resolution for the JSCameraConstraintsBuilder
.
JS-WASM
This is exported as set_Resolution
.
sourcepub fn max_resolution(
self,
max_resolution: Resolution
) -> JSCameraConstraintsBuilder
pub fn max_resolution( self, max_resolution: Resolution ) -> JSCameraConstraintsBuilder
Sets the maximum resolution for the JSCameraConstraintsBuilder
.
JS-WASM
This is exported as set_MaxResolution
.
sourcepub fn resolution_exact(self, value: bool) -> JSCameraConstraintsBuilder
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
.
sourcepub fn min_aspect_ratio(self, ratio: f64) -> JSCameraConstraintsBuilder
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
.
sourcepub fn aspect_ratio(self, ratio: f64) -> JSCameraConstraintsBuilder
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
.
sourcepub fn max_aspect_ratio(self, ratio: f64) -> JSCameraConstraintsBuilder
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
.
sourcepub fn aspect_ratio_exact(self, value: bool) -> JSCameraConstraintsBuilder
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
.
sourcepub fn facing_mode(
self,
facing_mode: JSCameraFacingMode
) -> JSCameraConstraintsBuilder
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
.
sourcepub fn facing_mode_exact(self, value: bool) -> JSCameraConstraintsBuilder
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
.
sourcepub fn min_frame_rate(self, fps: u32) -> JSCameraConstraintsBuilder
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
.
sourcepub fn frame_rate(self, fps: u32) -> JSCameraConstraintsBuilder
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
.
sourcepub fn max_frame_rate(self, fps: u32) -> JSCameraConstraintsBuilder
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
.
sourcepub fn frame_rate_exact(self, value: bool) -> JSCameraConstraintsBuilder
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
.
sourcepub fn resize_mode(
self,
resize_mode: JSCameraResizeMode
) -> JSCameraConstraintsBuilder
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
.
sourcepub fn resize_mode_exact(self, value: bool) -> JSCameraConstraintsBuilder
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
.
sourcepub fn device_id(self, id: &str) -> JSCameraConstraintsBuilder
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
.
sourcepub fn device_id_exact(self, value: bool) -> JSCameraConstraintsBuilder
pub fn device_id_exact(self, value: bool) -> JSCameraConstraintsBuilder
sourcepub fn group_id(self, id: &str) -> JSCameraConstraintsBuilder
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
.
sourcepub fn group_id_exact(self, value: bool) -> JSCameraConstraintsBuilder
pub fn group_id_exact(self, value: bool) -> JSCameraConstraintsBuilder
source§impl JSCameraConstraintsBuilder
impl JSCameraConstraintsBuilder
sourcepub fn build(self) -> JSCameraConstraints
pub fn build(self) -> JSCameraConstraints
Builds the JSCameraConstraints
Trait Implementations§
source§impl Clone for JSCameraConstraintsBuilder
impl Clone for JSCameraConstraintsBuilder
source§fn clone(&self) -> JSCameraConstraintsBuilder
fn clone(&self) -> JSCameraConstraintsBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more