MediaTrackConstraints.logicalSurface - Web APIs 编辑
The MediaTrackConstraints
dictionary's logicalSurface
property is a 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 ignore any constraints they're unfamiliar with.
Syntax
var constraintsObject = { logicalSurface: constraint }; constraintsObject.logicalSurface = constraint;
Value
A ConstrainBoolean
which is true
if logical surfaces should be permitted among the selections available to the user.
See How constraints are defined in Capabilities, constraints, and settings for an explanation of how to define constraints.
Usage notes
You can check the setting selected by the user agent after the display media has been created by getDisplayMedia()
by calling getSettings()
on the display media's video MediaStreamTrack
, then checking the value of the returned MediaTrackSettings
object's logicalSurface
object.
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.
Specifications
Specification | Status | Comment |
---|---|---|
Screen Capture The definition of 'MediaTrackConstraints.logicalSurface' in that specification. | Working Draft | Initial specification. |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论