Struct nokhwa::js_camera::JSCameraConstraints
source · pub struct JSCameraConstraints { /* private fields */ }
input-jscam
only.Expand description
Constraints to create a JSCamera
If you want more options, see JSCameraConstraintsBuilder
JS-WASM
This is exported as CameraConstraints
.
Implementations§
source§impl JSCameraConstraints
impl JSCameraConstraints
sourcepub fn media_constraints(&self) -> MediaStreamConstraints
pub fn media_constraints(&self) -> MediaStreamConstraints
sourcepub fn min_resolution(&self) -> Option<Resolution>
pub fn min_resolution(&self) -> Option<Resolution>
sourcepub fn set_min_resolution(&mut self, min_resolution: Resolution)
pub fn set_min_resolution(&mut self, min_resolution: Resolution)
sourcepub fn resolution(&self) -> Resolution
pub fn resolution(&self) -> Resolution
sourcepub fn set_resolution(&mut self, preferred_resolution: Resolution)
pub fn set_resolution(&mut self, preferred_resolution: Resolution)
Sets the internal Resolution
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_Resolution
.
sourcepub fn max_resolution(&self) -> Option<Resolution>
pub fn max_resolution(&self) -> Option<Resolution>
sourcepub fn set_max_resolution(&mut self, max_resolution: Resolution)
pub fn set_max_resolution(&mut self, max_resolution: Resolution)
sourcepub fn resolution_exact(&self) -> bool
pub fn resolution_exact(&self) -> bool
sourcepub fn set_resolution_exact(&mut self, resolution_exact: bool)
pub fn set_resolution_exact(&mut self, resolution_exact: bool)
Sets the internal resolution exact.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_ResolutionExact
.
sourcepub fn min_aspect_ratio(&self) -> Option<f64>
pub fn min_aspect_ratio(&self) -> Option<f64>
Gets the minimum aspect ratio of the JSCameraConstraints
.
JS-WASM
This is exported as get_MinAspectRatio
.
sourcepub fn set_min_aspect_ratio(&mut self, min_aspect_ratio: f64)
pub fn set_min_aspect_ratio(&mut self, min_aspect_ratio: f64)
Sets the minimum aspect ratio of the JSCameraConstraints
.
JS-WASM
This is exported as set_MinAspectRatio
.
sourcepub fn aspect_ratio(&self) -> f64
pub fn aspect_ratio(&self) -> f64
sourcepub fn set_aspect_ratio(&mut self, aspect_ratio: f64)
pub fn set_aspect_ratio(&mut self, aspect_ratio: f64)
Sets the internal aspect ratio.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_AspectRatio
.
sourcepub fn max_aspect_ratio(&self) -> Option<f64>
pub fn max_aspect_ratio(&self) -> Option<f64>
sourcepub fn set_max_aspect_ratio(&mut self, max_aspect_ratio: f64)
pub fn set_max_aspect_ratio(&mut self, max_aspect_ratio: f64)
Sets the maximum internal aspect ratio.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_MaxAspectRatio
.
sourcepub fn aspect_ratio_exact(&self) -> bool
pub fn aspect_ratio_exact(&self) -> bool
sourcepub fn set_aspect_ratio_exact(&mut self, aspect_ratio_exact: bool)
pub fn set_aspect_ratio_exact(&mut self, aspect_ratio_exact: bool)
Sets the internal aspect ratio exact.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_AspectRatioExact
.
sourcepub fn facing_mode(&self) -> JSCameraFacingMode
pub fn facing_mode(&self) -> JSCameraFacingMode
sourcepub fn set_facing_mode(&mut self, facing_mode: JSCameraFacingMode)
pub fn set_facing_mode(&mut self, facing_mode: JSCameraFacingMode)
Sets the internal JSCameraFacingMode
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_FacingMode
.
sourcepub fn facing_mode_exact(&self) -> bool
pub fn facing_mode_exact(&self) -> bool
sourcepub fn set_facing_mode_exact(&mut self, facing_mode_exact: bool)
pub fn set_facing_mode_exact(&mut self, facing_mode_exact: bool)
Sets the internal facing mode exact
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_FacingModeExact
.
sourcepub fn min_frame_rate(&self) -> Option<u32>
pub fn min_frame_rate(&self) -> Option<u32>
sourcepub fn set_min_frame_rate(&mut self, min_frame_rate: u32)
pub fn set_min_frame_rate(&mut self, min_frame_rate: u32)
Sets the minimum internal frame rate
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_MinFrameRate
.
sourcepub fn frame_rate(&self) -> u32
pub fn frame_rate(&self) -> u32
sourcepub fn set_frame_rate(&mut self, frame_rate: u32)
pub fn set_frame_rate(&mut self, frame_rate: u32)
Sets the internal frame rate
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_FrameRate
.
sourcepub fn max_frame_rate(&self) -> Option<u32>
pub fn max_frame_rate(&self) -> Option<u32>
sourcepub fn set_max_frame_rate(&mut self, max_frame_rate: u32)
pub fn set_max_frame_rate(&mut self, max_frame_rate: u32)
Sets the maximum internal frame rate
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_MaxFrameRate
.
sourcepub fn frame_rate_exact(&self) -> bool
pub fn frame_rate_exact(&self) -> bool
sourcepub fn set_frame_rate_exact(&mut self, frame_rate_exact: bool)
pub fn set_frame_rate_exact(&mut self, frame_rate_exact: bool)
Sets the internal frame rate exact.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_FrameRateExact
.
sourcepub fn resize_mode(&self) -> JSCameraResizeMode
pub fn resize_mode(&self) -> JSCameraResizeMode
sourcepub fn set_resize_mode(&mut self, resize_mode: JSCameraResizeMode)
pub fn set_resize_mode(&mut self, resize_mode: JSCameraResizeMode)
Sets the internal JSCameraResizeMode
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_ResizeMode
.
sourcepub fn resize_mode_exact(&self) -> bool
pub fn resize_mode_exact(&self) -> bool
sourcepub fn set_resize_mode_exact(&mut self, resize_mode_exact: bool)
pub fn set_resize_mode_exact(&mut self, resize_mode_exact: bool)
Sets the internal resize mode exact.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_ResizeModeExact
.
sourcepub fn set_device_id(&mut self, device_id: String)
pub fn set_device_id(&mut self, device_id: String)
Sets the internal device ID.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_DeviceId
.
sourcepub fn device_id_exact(&self) -> bool
pub fn device_id_exact(&self) -> bool
sourcepub fn set_device_id_exact(&mut self, device_id_exact: bool)
pub fn set_device_id_exact(&mut self, device_id_exact: bool)
Sets the internal device ID exact.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_DeviceIdExact
.
sourcepub fn set_group_id(&mut self, group_id: String)
pub fn set_group_id(&mut self, group_id: String)
Sets the internal group ID.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_GroupId
.
sourcepub fn group_id_exact(&self) -> bool
pub fn group_id_exact(&self) -> bool
sourcepub fn set_group_id_exact(&mut self, group_id_exact: bool)
pub fn set_group_id_exact(&mut self, group_id_exact: bool)
Sets the internal group ID exact.
Note that this doesn’t affect the internal MediaStreamConstraints
until you call
apply_constraints()
JS-WASM
This is exported as set_GroupIdExact
.
source§impl JSCameraConstraints
impl JSCameraConstraints
sourcepub fn apply_constraints(&mut self)
pub fn apply_constraints(&mut self)
Applies any modified constraints.
Methods from Deref<Target = Object>§
sourcepub fn constructor(&self) -> Function
pub fn constructor(&self) -> Function
The constructor property returns a reference to the Object
constructor
function that created the instance object.
sourcepub fn has_own_property(&self, property: &JsValue) -> bool
pub fn has_own_property(&self, property: &JsValue) -> bool
The hasOwnProperty()
method returns a boolean indicating whether the
object has the specified property as its own property (as opposed to
inheriting it).
sourcepub fn is_prototype_of(&self, value: &JsValue) -> bool
pub fn is_prototype_of(&self, value: &JsValue) -> bool
The isPrototypeOf()
method checks if an object exists in another
object’s prototype chain.
sourcepub fn property_is_enumerable(&self, property: &JsValue) -> bool
pub fn property_is_enumerable(&self, property: &JsValue) -> bool
The propertyIsEnumerable()
method returns a Boolean indicating
whether the specified property is enumerable.
sourcepub fn to_locale_string(&self) -> JsString
pub fn to_locale_string(&self) -> JsString
The toLocaleString()
method returns a string representing the object.
This method is meant to be overridden by derived objects for
locale-specific purposes.
sourcepub fn to_string(&self) -> JsString
pub fn to_string(&self) -> JsString
The toString()
method returns a string representing the object.
Methods from Deref<Target = JsValue>§
pub const NULL: JsValue = JsValue{ idx: JSIDX_NULL, _marker: marker::PhantomData,}
pub const UNDEFINED: JsValue = JsValue{ idx: JSIDX_UNDEFINED, _marker: marker::PhantomData,}
pub const TRUE: JsValue = JsValue{ idx: JSIDX_TRUE, _marker: marker::PhantomData,}
pub const FALSE: JsValue = JsValue{ idx: JSIDX_FALSE, _marker: marker::PhantomData,}
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the f64
value of this JS value if it’s an instance of a
number.
If this JS value is not an instance of a number then this returns
None
.
sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
If this JS value is a string value, this function copies the JS string
value into wasm linear memory, encoded as UTF-8, and returns it as a
Rust String
.
To avoid the copying and re-encoding, consider the
JsString::try_from()
function from js-sys
instead.
If this JS value is not an instance of a string or if it’s not valid
utf-8 then this returns None
.
UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str
type which contains a few
caveats about the encodings.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the bool
value of this JS value if it’s an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None
.
sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function
.
sourcepub fn js_in(&self, obj: &JsValue) -> bool
pub fn js_in(&self, obj: &JsValue) -> bool
Applies the binary in
JS operator on the two JsValue
s.
sourcepub fn loose_eq(&self, other: &JsValue) -> bool
pub fn loose_eq(&self, other: &JsValue) -> bool
Compare two JsValue
s for equality, using the ==
operator in JS.
sourcepub fn unsigned_shr(&self, rhs: &JsValue) -> u32
pub fn unsigned_shr(&self, rhs: &JsValue) -> u32
Applies the binary >>>
JS operator on the two JsValue
s.
sourcepub fn checked_div(&self, rhs: &JsValue) -> JsValue
pub fn checked_div(&self, rhs: &JsValue) -> JsValue
Applies the binary /
JS operator on two JsValue
s, catching and returning any RangeError
thrown.
sourcepub fn pow(&self, rhs: &JsValue) -> JsValue
pub fn pow(&self, rhs: &JsValue) -> JsValue
Applies the binary **
JS operator on the two JsValue
s.
sourcepub fn lt(&self, other: &JsValue) -> bool
pub fn lt(&self, other: &JsValue) -> bool
Applies the binary <
JS operator on the two JsValue
s.
sourcepub fn le(&self, other: &JsValue) -> bool
pub fn le(&self, other: &JsValue) -> bool
Applies the binary <=
JS operator on the two JsValue
s.
sourcepub fn ge(&self, other: &JsValue) -> bool
pub fn ge(&self, other: &JsValue) -> bool
Applies the binary >=
JS operator on the two JsValue
s.
sourcepub fn gt(&self, other: &JsValue) -> bool
pub fn gt(&self, other: &JsValue) -> bool
Applies the binary >
JS operator on the two JsValue
s.
sourcepub fn unchecked_into_f64(&self) -> f64
pub fn unchecked_into_f64(&self) -> f64
Applies the unary +
JS operator on a JsValue
. Can throw.
Trait Implementations§
source§impl Clone for JSCameraConstraints
impl Clone for JSCameraConstraints
source§fn clone(&self) -> JSCameraConstraints
fn clone(&self) -> JSCameraConstraints
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more