Options
All
  • Public
  • Public/Protected
  • All
Menu

Available settings for configuring the webcam.

Hierarchy

  • WebcamSettings

Index

Properties

constraints?: Partial<WebcamConstraints> | MediaTrackConstraints

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
}
crop_height: number

Height of the final cropped image in pixels, defaults to dest_height.

crop_width: number

Width of the final cropped image in pixels, defaults to dest_width.

dest_height?: number

Height of the captured camera image in pixels, defaults to the live viewer size.

dest_width?: number

Width of the captured camera image in pixels, defaults to the live viewer size.

enable_flash?: boolean

Enable or disable Flash fallback, if there is no native webcam access.

flashNotDetectedText?: string

HTML string for flash player not detected.

flip_horiz?: boolean

Setting this to true will flip the image horizontally (mirror mode).

force_flash?: boolean

Setting this to true will always run in Adobe Flash fallback mode.

fps?: number

Set the desired fps (frames per second) capture rate.

height?: number

Height of the live camera viewer in pixels, defaults to the actual size of the DOM element.

image_format?: ImageFormat

Desired image format of captured image.

jpeg_quality?: number

For JPEG images, this is the desired quality, from 0 (worst) to 100 (best).

swfURL?: string

Set an alternate location for the Adobe Flash fallback SWF file.

unfreeze_snap?: boolean

Whether to unfreeze the camera after snap (defaults to true)

upload_name?: string

Which HTTP POST parameter name to use when uploading the webcam image file.

width?: number

Width of the live camera viewer in pixels, defaults to the actual size of the DOM element.

Generated using TypeDoc