åªä½è¿½è¸ªçº¦æ
The MediaTrackConstraints dictionary is used to describe a set of capabilities and the value or values each can take on. A constraints dictionary is passed into applyConstraints() to allow a script to establish a set of exact (required) values or ranges and/or preferred values or ranges of values for the track, and the most recently-requested set of custom constraints can be retrieved by calling getConstraints().
For each constraint, you can typically specify an exact value you need, an ideal value you want, a range of acceptable values, and/or a value which you'd like to be as close to as possible. The specifics vary somewhat depending on the type of the constrainable property.
To learn more about how constraints work, see Capabilities, constraints, and settings.
Properties
Some combinationâbut not necessarily allâof the following properties will exist on the object.
Properties of all media tracks
deviceId-
A
ConstrainDOMStringobject specifying a device ID or an array of device IDs which are acceptable and/or required. groupId-
A
ConstrainDOMStringobject specifying a group ID or an array of group IDs which are acceptable and/or required.
Properties of audio tracks
autoGainControl-
ä¸ä¸ª
ConstrainBoolean对象ï¼ç¨æ¥æææ¯å¦é¦éæè¦æ±ä½¿ç¨å£°é³çèªå¨å¢çã channelCount-
ä¸ä¸ª
ConstrainLongï¼ç¨æ¥ææå¯éæè¦æ±ç声鿰æè æ¯å£°éæ°çèå´ã echoCancellation-
ä¸ä¸ª
ConstrainBoolean对象ï¼ç¨æ¥æææ¯å¦é¦éæéè¦å¼å¯å声æ¶é¤ã latency-
ä¸ä¸ª
ConstrainDoubleï¼ç¨æ¥ææå¤å¤§å»¶è¿æ¯è¢«å¯æ¥åçã noiseSuppression-
ä¸ä¸ª
ConstrainBooleanï¼ç¨æ¥æææ¯å¦é¦éæéè¦å¼å¯éåªã sampleRate-
ä¸ä¸ª
ConstrainLongï¼ç¨æ¥ææå¯æ¥åçæè¦æ±çé³é¢éæ ·ç/éæ ·çèå´ã sampleSize-
ä¸ä¸ª
ConstrainLongï¼ç¨æ¥ææå¯æ¥åçæè¦æ±çé³é¢éæ ·å¤§å°/éæ ·èå´ã volume-
ä¸ä¸ª
ConstrainDoubleï¼ç¨æ¥ææå¯æ¥åçæè¦æ±çé³é大å°/èå´ã
Properties of image tracks
whiteBalanceMode-
A
Stringspecifying one of"none","manual","sigle-shot", or"continuous". exposureMode-
A
Stringspecifying one of"none","manual","sigle-shot", or"continuous". focusMode-
A
Stringspecifying one of"none","manual","sigle-shot", or"continuous". pointsOfInterest-
The pixel coordinates on the sensor of one or more points of interest. This is either an object in the form { x:value, y:value } or an array of such objects, where value is a double-precision integer.
exposureCompensation-
A
ConstrainDouble(a double-precision integer) specifying f-stop adjustment by up to ±3. colorTemperature-
A
ConstrainDouble(a double-precision integer) specifying a desired color temperature in degrees kelvin. iso-
A
ConstrainDouble(a double-precision integer) specifying a desired iso setting. brightness-
A
ConstrainDouble(a double-precision integer) specifying a desired brightness setting. contrast-
A
ConstrainDouble(a double-precision integer) specifying the degree of difference between light and dark. saturation-
A
ConstrainDouble(a double-precision integer) specifying the degree of color intensity. -
A
ConstrainDouble(a double-precision integer) specifying the intensity of edges. focusDistance-
A
ConstrainDouble(a double-precision integer) specifying distance to a focused object. zoom-
A
ConstrainDouble(a double-precision integer) specifying the desired focal length. torch-
A
Booleanwhter the fill light continuously connected, meaning it stays on as long as the track is active.
Properties of video tracks
aspectRatio-
A
ConstrainDoublespecifying the video aspect ratio or range of aspect ratios which are acceptable and/or required. facingMode-
A
ConstrainDOMStringobject specifying a facing or an array of facings which are acceptable and/or required. frameRate-
A
ConstrainDoublespecifying the frame rate or range of frame rates which are acceptable and/or required. height-
A
ConstrainLongspecifying the video height or range of heights which are acceptable and/or required. width-
A
ConstrainLongspecifying the video width or range of widths which are acceptable and/or required.
Specifications
| è§è |
|---|
| Media Capture and Streams > # dom-mediatrackconstraints > |
| Screen Capture > # extensions-to-mediatrackconstraintset > |