MediaTrackConstraints

번역이 완료되지 않았습니다. Please help translate this article from English

MediaTrackConstraints 연관 배열은 트랙의 기능 및 기능이 받는 값 또는 값의 범위를 설명합니다. applyConstraints()에 전달해서, 스크립트가 일련의 필수(일치) 조건과 선호 조건의 값과 범위를 트랙에 설정할 수 있으며, 가장 최근에 설정한 사용자 지정 제약은 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 기능, 제약, 설정.

속성

Some combination—but not necessarily all—of the following properties will exist on the object. This may be because a given browser doesn't support the property, or because it doesn't apply. For example, because RTP doesn't provide some of these values during negotiation of a WebRTC connection, a track associated with a RTCPeerConnection will not include certain values, such as facingMode or groupId.

모든 미디어 트랙의 속성

deviceId
A ConstrainDOMString object specifying a device ID or an array of device IDs which are acceptable and/or required.
groupId
A ConstrainDOMString object specifying a group ID or an array of group IDs which are acceptable and/or required.

오디오 트랙의 속성

autoGainControl
A ConstrainBoolean object which specifies whether automatic gain control is preferred and/or required.
channelCount
A ConstrainLong specifying the channel count or range of channel counts which are acceptable and/or required.
echoCancellation
A ConstrainBoolean object specifying whether or not echo cancellation is preferred and/or required.
latency
A ConstrainDouble specifying the latency or range of latencies which are acceptable and/or required.
noiseSuppression
A ConstrainBoolean which specifies whether noise suppression is preferred and/or required.
sampleRate
A ConstrainLong specifying the sample rate or range of sample rates which are acceptable and/or required.
sampleSize
A ConstrainLong specifying the sample size or range of sample sizes which are acceptable and/or required.
volume
A ConstrainDouble specifying the volume or range of volumes which are acceptable and/or required.

이미지 트랙의 속성

whiteBalanceMode
A String specifying one of "none", "manual", "single-shot", or "continuous".
exposureMode
A String specifying one of "none", "manual", "single-shot", or "continuous".
focusMode
A String specifying one of "none", "manual", "single-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.
sharpness
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 Boolean defining whether the fill light is continuously connected, meaning it stays on as long as the track is active.

비디오 트랙의 속성

aspectRatio
A ConstrainDouble specifying the video aspect ratio or range of aspect ratios which are acceptable and/or required.
facingMode
A ConstrainDOMString object specifying a facing or an array of facings which are acceptable and/or required.
frameRate
A ConstrainDouble specifying the frame rate or range of frame rates which are acceptable and/or required.
height
A ConstrainLong specifying the video height or range of heights which are acceptable and/or required.
width
A ConstrainLong specifying the video width or range of widths which are acceptable and/or required.
resizeMode
A ConstrainDOMString object specifying a mode or an array of modes the UA can use to derive the resolution of a video track. Allowed values are none and crop-and-scale. none means that the user agent uses the resolution provided by the camera, its driver or the OS. crop-and-scale means that the user agent can use cropping and downscaling on the camera output  in order to satisfy other constraints that affect the resolution.

화면 공유 트랙의 속성

These constraints apply to MediaTrackConstraints objects specified as part of the DisplayMediaStreamConstraints object's video property when using getDisplayMedia() to obtain a stream for screen sharing.

cursor

A ConstrainDOMString which specifies whether or not to include the mouse cursor in the generated track, and if so, whether or not to hide it while not moving. The value may be a single one of the following strings, or an array of them to allow the browser flexibility in deciding what to do about the cursor.

always
The mouse is always visible in the video content of the {domxref("MediaStream"), unless the mouse has moved outside the area of the content.
motion
The mouse cursor is always included in the video if it's moving, and for a short time after it stops moving.
never
The mouse cursor is never included in the shared video.
displaySurface

A ConstrainDOMString which specifies the types of display surface that may be selected by the user. This may be a single one of the following strings, or a list of them to allow multiple source surfaces:

application
The stream contains all of the windows of the application chosen by the user rendered into the one video track.
browser
The stream contains the contents of a single browser tab selected by the user.
monitor
The stream's video track contains the entire contents of one or more of the user's screens.
window
The stream contains a single window selected by the user for sharing.
logicalSurface
A ConstrainBoolean value which may contain a single Boolean value or a set of them, indicating whether or not to allow the user to choose source surfaces which do not directly correspond to display areas. These may include backing buffers for windows to allow capture of window contents that are hidden by other windows in front of them, or buffers containing larger documents that need to be scrolled through to see the entire contents in their windows.

명세

Specification Status Comment
Media Capture and Streams Candidate Recommendation Initial definition.
MediaStream Image Capture Working Draft Adds image constraints.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
MediaTrackConstraintsChrome Full support 59Edge Full support ≤18Firefox Full support YesIE No support NoOpera Full support 46Safari ? WebView Android Full support 59Chrome Android Full support YesFirefox Android Full support YesOpera Android Full support 43Safari iOS ? Samsung Internet Android Full support Yes
aspectRatioChrome Full support 59Edge Full support ≤79Firefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 29Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
autoGainControlChrome Full support YesEdge Full support ≤79Firefox Full support 55
Full support 55
Full support 46
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 55
Full support 55
Full support 46
Prefixed
Prefixed Implemented with the vendor prefix: moz
Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes
channelCountChrome Full support 59Edge Full support ≤79Firefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
cursorChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android No support No
deviceIdChrome Full support 59Edge Full support ≤79Firefox Full support 36
Notes
Full support 36
Notes
Notes Prior to Firefox 69, Firefox only supported deviceId in constraints passed into getUserMedia().
IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 36
Notes
Full support 36
Notes
Notes Firefox for Android only supports deviceId when used in constraints passed into getUserMedia().
Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
displaySurfaceChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android No support No
echoCancellationChrome Full support 59Edge Full support ≤79Firefox Full support 50IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 50Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
facingModeChrome Full support 59Edge Full support ≤79Firefox Full support 50IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 50Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
frameRateChrome Full support 59Edge Full support ≤79Firefox Full support 50IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 50Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
groupIdChrome Full support 59Edge Full support ≤79Firefox Full support 70IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
heightChrome Full support 59Edge Full support ≤79Firefox Full support 50IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 50Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
latencyChrome Full support 59Edge Full support ≤79Firefox Full support 50IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 50Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
logicalSurfaceChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android No support No
noiseSuppressionChrome Full support YesEdge Full support ≤79Firefox Full support 55
Full support 55
Full support 46
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 55
Full support 55
Full support 46
Prefixed
Prefixed Implemented with the vendor prefix: moz
Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes
sampleRateChrome Full support 59Edge Full support ≤79Firefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
sampleSizeChrome Full support 59Edge Full support ≤79Firefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
volume
DeprecatedNon-standard
Chrome Full support 59Edge Full support ≤79Firefox No support NoIE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android Full support 7.0
widthChrome Full support 59Edge Full support ≤79Firefox Full support 50IE No support NoOpera Full support YesSafari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android Full support 50Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

같이 보기