The HTML5 getUserMedia API has a constraints system by which you can specify optional or mandatory
requirements for the video stream. These include things such a minimum or maximum resolution and/or
framerate. By default, WebcamJS will specify a mandatory minimum width and height, matching your dest_width
and dest_height
parameters. However, if you want to customize this, you can set a constraints parameter
using Webcam.set()
, and pass in an object containing all the custom constraints you want:
Webcam.set("constraints", {
mandatory: {
minWidth: 1280,
minHeight: 720,
minFrameRate: 30,
},
optional: [
{
minFrameRate: 60,
}
],
});
To remove the mandatory constraints and instead just specify the resolution you would prefer, you can just
this property set this to a MediaTrackConstraints
object:
Webcam.set("constraints", {
width: 1280,
height: 720
}
Height of the final cropped image in pixels, defaults to dest_height
.
Width of the final cropped image in pixels, defaults to dest_width
.
Height of the captured camera image in pixels, defaults to the live viewer size.
Width of the captured camera image in pixels, defaults to the live viewer size.
Enable or disable Flash fallback, if there is no native webcam access.
HTML string for flash player not detected.
Setting this to true will flip the image horizontally (mirror mode).
Setting this to true will always run in Adobe Flash fallback mode.
Set the desired fps (frames per second) capture rate.
Height of the live camera viewer in pixels, defaults to the actual size of the DOM element.
Desired image format of captured image.
For JPEG images, this is the desired quality, from 0 (worst) to 100 (best).
Set an alternate location for the Adobe Flash fallback SWF file.
Whether to unfreeze the camera after snap (defaults to true)
Which HTTP POST parameter name to use when uploading the webcam image file.
Width of the live camera viewer in pixels, defaults to the actual size of the DOM element.
Generated using TypeDoc
Available settings for configuring the webcam.