MediaTrackConstraints dictionary's logicalSurface 特性为 ConstrainDOMString describing the requested or mandatory constraints placed upon the value of the logicalSurface constrainable property. This is used to specify whether or not getDisplayMedia() should allow the user to choose display surfaces which are not necessarily fully visible on the screen, such as occluded windows or the complete content of windows which are large enough to require scrolling to see their entire contents.

If needed, you can determine whether or not this constraint is supported by checking the value of MediaTrackSupportedConstraints.logicalSurface as returned by a call to MediaDevices.getSupportedConstraints() . However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with.

句法

var constraintsObject = { logicalSurface: constraint };
constraintsObject.logicalSurface = constraint;
					

A ConstrainBoolean which is true if logical surfaces should be permitted among the selections available to the user.

How constraints are defined in Capabilities, constraints, and settings for an explanation of how to define constraints.

用法注意事项

You can check the setting selected by the user agent after the display media has been created by getDisplayMedia() 通过调用 getSettings() on the display media's video MediaStreamTrack , then checking the value of  the returned MediaTrackSettings 对象的 logicalSurface 对象。

For example, if your app needs to know if the selected display surface is a logical one:

let isLogicalSurface = displayStream.getVideoTracks()[0].getSettings().logicalSurface;
					

Following this code, isLogicalSurface is true if the display surface contained in the stream is a logical surface; that is, one which may not be entirely onscreen, or may even be entirely offscreen.

规范

规范 状态 注释
Screen Capture
The definition of 'MediaTrackConstraints.logicalSurface' in that specification.
工作草案 最初的规范。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
logicalSurface Chrome No Edge No Firefox No IE No Opera Yes Safari ? WebView Android No Chrome Android No Firefox Android No Opera Android ? Safari iOS ? Samsung Internet Android No

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

另请参阅

元数据

  • 最后修改: