MediaTrackSupportedConstraints
MediaTrackSupportedConstraints 字典建立了 用户代理 或浏览器在其对 对象实现中所识别的可约束属性列表。符合 MediaStreamTrackMediaTrackSupportedConstraints 的对象由 返回。MediaDevices.getSupportedConstraints()
由于 WebIDL 中接口定义的处理方式,如果在请求时指定了某个约束但该约束不受支持,则不会发生错误。相反,将应用指定的约束,并将任何未识别的约束从请求中移除。这可能导致难以调试的混淆错误,因此,如果您需要区分静默忽略约束和约束被接受,请务必在使用 getSupportedConstraints() 检索此信息后再尝试设置约束。
实际的约束集使用基于 字典的对象来描述。MediaTrackConstraints
要了解有关约束工作原理的更多信息,请参阅 功能、约束和设置。
实例属性
对象上将存在以下属性的某些组合(但不一定是全部)。
aspectRatio-
如果当前环境中支持
约束,则为aspectRatiotrue。 autoGainControl-
如果当前环境中支持
约束,则为autoGainControltrue。 channelCount-
如果当前环境中支持
约束,则为channelCounttrue。 deviceId-
如果当前环境中支持
约束,则为deviceIdtrue。 echoCancellation-
如果当前环境中支持
约束,则为echoCancellationtrue。 facingMode-
如果当前环境中支持
约束,则为facingModetrue。 frameRate-
如果当前环境中支持
约束,则为frameRatetrue。 groupId-
如果当前环境中支持
约束,则为groupIdtrue。 height-
如果当前环境中支持
约束,则为heighttrue。 latency-
如果当前环境中支持
约束,则为latencytrue。 noiseSuppression-
如果当前环境中支持
约束,则为noiseSuppressiontrue。 restrictOwnAudio-
如果当前环境中支持
约束,则为restrictOwnAudiotrue。 resizeMode-
如果当前环境中支持
约束,则为resizeModetrue。 sampleRate-
如果当前环境中支持
约束,则为sampleRatetrue。 sampleSize-
如果当前环境中支持
约束,则为sampleSizetrue。 suppressLocalAudioPlayback-
如果当前环境中支持
约束,则为suppressLocalAudioPlaybacktrue。 volume已弃用 非标准-
如果当前环境中支持
约束,则为volumetrue。 width-
如果当前环境中支持
约束,则为widthtrue。
共享屏幕轨道特有的实例属性
对于包含用户屏幕视频源的轨道,除了可用于视频轨道的属性外,可能还会包含以下附加属性:
displaySurface-
如果当前环境中支持
约束,则为displaySurfacetrue。 logicalSurface-
如果当前环境中支持
约束,则为logicalSurfacetrue。
规范
| 规范 |
|---|
| 媒体捕获和流 # media-track-supported-constraints |