ConstrainDOMString
dictionary is used to specify a constraint for a property whose value is a string. It allows you to specify one or more
exact
string values from which one must be the parameter's value, or a set of
ideal
values which should be used if possible. You can also specify a single string (or an array of strings) which the user agent will do its best to match once all more stringent constraints have been applied.
The value of a
ConstrainDOMString
可以是下列任一:
exact
DOMString
which must be the value of the property, or an array of
DOMString
objects one of which must be the property's value. If the property can't be set to one of the listed values, matching will fail.
ideal
DOMString
or an arrray of
DOMString
s specifying ideal values for the property. If possible, one of the listed values will be used, but if it's not possible, the user agent will use the closest possible match.
| 规范 | 状态 | 注释 |
|---|---|---|
|
媒体捕获和流
The definition of 'ConstrainDOMString' in that specification. |
候选推荐 | 初始定义 |
Technically,
ConstrainDOMString
is actually based on an intermediary dictionary named
ConstrainDOMStringParameters
, which adds
exact
and
ideal
to
DOMString
. However, for the sake of documentation clarity, the intermediate type (present only because of quirks in
WebIDL
syntax) is ignored here.
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
ConstrainDOMString
|
Chrome Yes | Edge ≤79 | Firefox 50 | IE No | Opera Yes | Safari ? | WebView Android Yes | Chrome Android Yes | Firefox Android 50 | Opera Android Yes | Safari iOS ? | Samsung Internet Android Yes |
完整支持
不支持
兼容性未知
MediaTrackConstraints
MediaTrackCapabilities
MediaTrackSupportedConstraints
ConstrainDOMString
AudioStreamTrack
BlobEvent
CanvasCaptureMediaStream
ConstrainBoolean
ConstrainDouble
ConstrainLong
DoubleRange
HTMLCanvasElement.captureStream()
LongRange
MediaDevices
MediaStream
MediaStreamTrack
MediaStreamTrackEvent
MediaTrackCapabilities
MediaTrackConstraints
MediaTrackSettings
MediaTrackSupportedConstraints
Navigator.mediaDevices
NavigatorUserMedia
NavigatorUserMediaError
VideoStreamTrack
navigator.mediaDevices.getUserMedia()