Options
All
  • Public
  • Public/Protected
  • All
Menu

Available settings for configuring the webcam.

Hierarchy

  • WebcamSettings

Index

Properties

Optional constraints

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

crop_height: number

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

crop_width

crop_width: number

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

Optional dest_height

dest_height?: number

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

Optional dest_width

dest_width?: number

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

Optional enable_flash

enable_flash?: boolean

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

Optional flashNotDetectedText

flashNotDetectedText?: string

HTML string for flash player not detected.

Optional flip_horiz

flip_horiz?: boolean

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

Optional force_flash

force_flash?: boolean

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

Optional fps

fps?: number

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

Optional height

height?: number

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

Optional image_format

image_format?: ImageFormat

Desired image format of captured image.

Optional jpeg_quality

jpeg_quality?: number

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

Optional swfURL

swfURL?: string

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

Optional unfreeze_snap

unfreeze_snap?: boolean

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

Optional upload_name

upload_name?: string

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

Optional width

width?: number

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

Generated using TypeDoc